If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > SQL to VBA code question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-21-11, 07:46
imwild124 imwild124 is offline
Registered User
 
Join Date: Jul 2011
Posts: 6
SQL to VBA code question

Hello,

I was hoping someone might be able to help me with the following piece of code. I'm trying to run a SQL query directly from Excel and so I've converted a SQL Query into the following, however there still appears to be something wrong that I'm not quite catching. I'm fairly convinced that the error is somewhere in the following bit of code but I just don't see it. Any help would be appreciated.

"WHERE [Facility] = '" & Facility & "' and [Week_Ending] = '" & WeekEnd & "' and (Ledgend LIKE 'DEL') AND [Route #] IN " & _
"( SELECT DISTINCT [Route #] FROM HIS.dbo.tbl_Master WHERE " & _
WhereStr & " AND (Ledgend LIKE 'DEL') " & _

Thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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