Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Syntax for Excel variable using a SQL Select/From/Where Command...
Mark,
Try something like the following: Dim SQL As String SQL = "SELECT tblStoreList.`Store Name` " & _ " FROM `\\RT-Admin\Adminshare\Robert\Setup`.tblStoreList tblStoreList " & _ "WHERE (tblStoreList.`Store #`=" & Range("A1").Text & ")" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Mark D." <Mark wrote in message ... What is the proper syntax for using the contents of an Excel cell in an SQL Select/From/Where command. I'm trying to do a table lookup look-up in an Access DB from Excel based on the value of the contents in an Excel cell. Here is my statement. SELECT tblStoreList.`Store Name` FROM `\\RT-Admin\Adminshare\Robert\Setup`.tblStoreList tblStoreList WHERE (tblStoreList.`Store #`=?????) I can't seem to get the right syntax for referencing cell B6 at the end of the statement. Both the cell and the Access table field are numeric. I started out using MS Query and put a specific value in the statement. Then tried to modify the SQL to reference a cell. Any suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command text syntax and comma | Excel Programming | |||
Correct syntax for use Replace command via DDE? | Excel Programming | |||
Syntax for variable search | Excel Programming | |||
Syntax for variable search | Excel Programming | |||
Syntax for variable search | Excel Programming |