![]() |
Excel VB - WHERE syntax error in Access web query.
Greetings,
I searched and found several posts and tried to use them to find out where I am going wrong but no luck. I am attempting to run a query from a database that will look to a specific sheet in the workbook for the date range to be used. This works: "SELECT `Time ( < 16 )`.`Employee ID`, `Time ( < 16 )`.`System ID`, `Time ( < 16 )`.`Project Code`, `Time ( < 16 )`.SumOfHours, `Time ( < 16 )`.`First Name`, `Time ( < 16 )" _ , "`.`Last Name`" & Chr(13) & "" & Chr(10) & "FROM `X:\Time\TKS`.`Time ( < 16 )` `Time ( < 16 )`") This doesn't: "SELECT `Time ( < 16 )`.`Employee ID`, `Time ( < 16 )`.`System ID`, `Time ( < 16 )`.`Project Code`, `Time ( < 16 )`.SumOfHours, `Time ( < 16 )`.`First Name`, `Time ( < 16 )" _ , "`.`Last Name`" & Chr(13) & "" & Chr(10) & "FROM `X:\Time\TKS`.`Time ( < 16 )` `Time ( < 16 )`" & Chr(13) & "" & Chr(10) & "WHERE(`Time ( < 16 )`.Date)10/10/06") It returns a general odbc error. I added : & Chr(13) & "" & Chr(10) & "WHERE(`Time ( < 16 )`.Date)10/10/06") Any help is appreciated. The ultimate goal is to have the 10/10/06 reference two cells and possibly have a from and to selection but I had seen enough on the variable piece I figure I could do that once I had the basics down. Thanks! |
Excel VB - WHERE syntax error in Access web query.
Does this code run in access or excel? Using ADO? What data source provider
are you using? -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect wrote: | Greetings, | | I searched and found several posts and tried to use them to find out | where I am going wrong but no luck. I am attempting to run a query | from a database that will look to a specific sheet in the workbook for | the date range to be used. | | This works: | "SELECT `Time ( < 16 )`.`Employee ID`, `Time ( < 16 )`.`System | ID`, `Time ( < 16 )`.`Project Code`, `Time ( < 16 )`.SumOfHours, `Time | ( < 16 )`.`First Name`, `Time ( < 16 )" _ | , "`.`Last Name`" & Chr(13) & "" & Chr(10) & "FROM | `X:\Time\TKS`.`Time ( < 16 )` `Time ( < 16 )`") | | This doesn't: | "SELECT `Time ( < 16 )`.`Employee ID`, `Time ( < 16 )`.`System | ID`, `Time ( < 16 )`.`Project Code`, `Time ( < 16 )`.SumOfHours, `Time | ( < 16 )`.`First Name`, `Time ( < 16 )" _ | , "`.`Last Name`" & Chr(13) & "" & Chr(10) & "FROM | `X:\Time\TKS`.`Time ( < 16 )` `Time ( < 16 )`" & Chr(13) & "" & | Chr(10) & "WHERE(`Time ( < 16 )`.Date)10/10/06") | | It returns a general odbc error. | | I added : | | & Chr(13) & "" & Chr(10) & "WHERE(`Time ( < 16 )`.Date)10/10/06") | | Any help is appreciated. The ultimate goal is to have the 10/10/06 | reference two cells and possibly have a from and to selection but I had | seen enough on the variable piece I figure I could do that once I had | the basics down. | | Thanks! | |
All times are GMT +1. The time now is 02:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com