View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joemeshuggah joemeshuggah is offline
external usenet poster
 
Posts: 96
Default query external database

the problem is when i copy and paste the query into the macro...for example

query = "select * from mytbl inner join mytbl2 on mytbl.a=mytbl2.a" would
work fine...

but when copying and pasting the query as written into the macro, the red
text appears (a quote appears automatically after select *, inner join mytbl2
on and mytbl.a=mytbl2.a appear in red and a quote automatically appears after
mytbl.a=mytbl2.a).

query = "select * "
from mytbl
inner join mytbl2 on
mytbl.a=mytbl2.a"


is it possible to paste the query without reformatting it...and if not, how
do you reformat to ensure there are no syntax errors? here is an example of
how the query is formatted:

select *

from

mytbl

inner join mytbl2 on
mytbl.a=mytbl2.a


"FSt1" wrote:

hi
if high lighted in red then you have a syntax problem
post your macro.

regards
FSt1

"joemeshuggah" wrote:

i have a macro that automatically runs a query in an external database
(teradata) and puts the results in excel...the query is very simple...e.g.

query = "select * from mytbl"

i would like to use the same idea for more complex queries (multiple joins
and conditions, etc), however when i paste the query into the macro, the
formatting causes issues (e.g. the query text is highlighted in red). how do
i incorporate the new query? i tried using _ to connect, but at one point i
received a message that too many were used.