Bonediggler1
Technical User
Hi-
I have a chunk of code that defines the SQL statement to be used in a pass through query to an Oracle DB. The SQL is broken up into 2 parts: the first part is very long and static, and the second part changes each time the DB is run. I use VBA to concatenate the 2 parts.
The problem is that when feeding the string to the pass through query, I get "Syntax error, missing operator".
When I get the string from the immediate window and then paste into Toad for Oracle, it seems as though access is breaking up the string in the middle of words. When I correct this in Toad the query runs fine...so it is not a syntax error on my part.
For example the string is something like this (only much longer):
"SELECT BLAH1 " & _
"BLAH2, BLAH3, BLAH4 " & _
"BLAH5 FROM " & _
"TABLE1 WHERE BLAH"
When taking this from the Immediate Window it is more like:
"SELECT BLAH1, BLAH2, BLAH3, BLA
H4, BLAH5 FROM TABLE1 WHERE BLAH"
...which I think is causing the error.
Any suggestions?
Thank you!!!
I have a chunk of code that defines the SQL statement to be used in a pass through query to an Oracle DB. The SQL is broken up into 2 parts: the first part is very long and static, and the second part changes each time the DB is run. I use VBA to concatenate the 2 parts.
The problem is that when feeding the string to the pass through query, I get "Syntax error, missing operator".
When I get the string from the immediate window and then paste into Toad for Oracle, it seems as though access is breaking up the string in the middle of words. When I correct this in Toad the query runs fine...so it is not a syntax error on my part.
For example the string is something like this (only much longer):
"SELECT BLAH1 " & _
"BLAH2, BLAH3, BLAH4 " & _
"BLAH5 FROM " & _
"TABLE1 WHERE BLAH"
When taking this from the Immediate Window it is more like:
"SELECT BLAH1, BLAH2, BLAH3, BLA
H4, BLAH5 FROM TABLE1 WHERE BLAH"
...which I think is causing the error.
Any suggestions?
Thank you!!!