Thread: External Data
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_4_] Patrick Molloy[_4_] is offline
external usenet poster
 
Posts: 103
Default External Data

It woulf be useful to see your code.
however, your WHERE should look something akin to


DIM sSQL as String

sSQL ="Select [Field1],[Field2][,[fieldn]] FROM mytable WHERE [ThisField] =
'" & textbox1.text & "'"
sSQL = sSQL & " AND MyValue = " & txtbox2.text & ";"

note that for char type fields, wrap your text in single quotes. Numeric
fields don't need the quote

--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"James" wrote in message
...
I am trying to pass a SQL query with variables in the
WHERE clause through the external data function and can't
seem to get it to work. For instance, I want to pull back
a specific property or a group and the cash flows for the
last year depending on variables my user inputs using a
drop down. Any suggestions would be very appreciated.

Thank you.