Hi i have some code
rst.Open "Select HD as type From ChannelBrand where [Channel Brand] = '" & Cells(r, 1) & "'", conn If rst.EOF = False Then state = rst!Type rst.Close If state = True Then tag = 1 GoTo continue End If rst.Open "Select 3D as type From ChannelBrand where [Channel Brand] = '" & Cells(r, 1) & "'", conn If rst.EOF = False Then state = rst!Type rst.Close If state = True Then tag = 2 GoTo continue End If
the idea being that if hd = false then it runs the 3d code and if the 3d = false it runs some other code...
i get an error when 3d = false, but not when hd = false
i assumed it was an issue with channel brand being incorrect, but this doesn't appear to be the case
whats wrong?
thanks
What error and on which line?
the error is:
Syntax error (missing operator) in query expression '3D'.
on the line
rst.Open "Select 3D as type From ChannelBrand where [Channel Brand] = '" & Cells(r, 1) & "'", conn
which is odd as the HD query performs fine![]()
Last edited by romperstomper; 10-28-2010 at 07:18 AM. Reason: correct tag
Enclose the 3D in square brackets.
ah i see! this works now! thankyou!
is this because of the use of a number?
thanks
Jonathan
Yes. In strict SQL, database object names should begin with a letter and only include letters, numbers or underscoress, but many db systems allow you to violate that. If you do, you should enclose the table in [] - in fact it's usually easier to just do that all the time.
ok thanks! i'll bear this in mind for future applications![]()
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
How to mark a thread Solved
Go to the first post
Click edit
Click Go Advanced
Just below the word Title you will see a dropdown with the word No prefix.
Change to Solved
Click Save
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks