Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
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
Command text syntax and comma Dave Excel Programming 1 July 30th 04 07:47 PM
Correct syntax for use Replace command via DDE? Bjørn Holm Excel Programming 4 November 27th 03 01:07 PM
Syntax for variable search Tom Ogilvy Excel Programming 3 August 6th 03 06:16 PM
Syntax for variable search brym Excel Programming 2 August 6th 03 05:32 PM
Syntax for variable search Don Guillett[_4_] Excel Programming 0 August 6th 03 04:35 PM


All times are GMT +1. The time now is 08:04 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"