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!