Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel odbc ms query using cell as criteria value

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel cell contents to query criteria Jimbo Excel Discussion (Misc queries) 1 April 22nd 09 07:46 PM
Using A Cell In Excel as Criteria for a Query charles Excel Discussion (Misc queries) 2 July 14th 06 05:06 PM
How do I update a ODBC query in Excel using pivotTables in VBA? FCS Excel Programming 6 November 10th 05 04:47 PM
Excel ODBC Query H. Zhu Excel Programming 1 December 12th 03 03:42 AM
EXCEL AND ODBC AND QUERY Gary B[_3_] Excel Programming 1 August 5th 03 02:39 AM


All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"