View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default excel odbc ms query using cell as criteria value

your SQL would look like this:

SELECT [selection] FROM [source] WHERE [column] = '%token%'

in VBA, you could replace the token by the value in a cell...
lets say a string variable, sSQL contains the SQL text above, then

sSQL = REPLACE(sSQL,"%token%", sheet1.range("B1").Value)







"mgunther" wrote:

I have a excel odbc ms query of a sql db. I need to be able to pull one of
the criteria value from annother cell in excel that will change once a month.
Can anyone tell me how I would do this?

Thanks