Does anyone have any instruction on how to have MS Query pull the SQL statement from a sheet in Excel? my query is structured as
1st select on transactions from table1 linked to demographics from table2 and table3 where CUSTOMER#=ABC
union all from table2 where CUSTOMER#=ABC
My problem is I want to create a parameter that is pulled from my excel sheet for Customer# and it won't allow me to place the ? in both places where the Customer#= is in my SQL.
I can put the ? in the first statement but when I put it in the second (union all) I receive
[Microsoft][ODBC SQL Server Driver]unable to derive parameter information when parameter marker is a function argument then [Microsoft][ODBC SQL Server Driver] invlald Descriptor Index
My query runs smoothly takes about 20 seconds to return 4500 lines of data, but it is too combersom for the user to edit the SQL each time the customer# has to be changed.
I am using Excel 2007. The database I am quering from is at a thrid party site so I cannot create a view.