Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
External Data
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
External Data Warning Message - I have No External Data in wrkbk | Excel Discussion (Misc queries) | |||
Getting External Data based on criteria insde of the external data | Excel Discussion (Misc queries) | |||
Tying to extract all data from a pivot pulling from external data | Excel Discussion (Misc queries) | |||
updating external data sheet causes loss of data on linked pages | Excel Worksheet Functions | |||
External Data Queries - Data Range Properties v Spreadsheet Format | Excel Discussion (Misc queries) |