View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
hbj hbj is offline
external usenet poster
 
Posts: 35
Default Including date in SQL Where-clause in Excel 2007

I have a table Customers in an external Excel file, which has among others two date fields Started and Ended. In calculation I need to query records where parameter myDate is between Started and Ended. I cannot figure out the Where syntax.

In the Excel source file I can retrieve these record with simple excel functions, so it really works. I have also used the wizard to create the whole SQL statement and this way its working too. However, this where-statement looks like
WHERE (Customers.Started<={ts 2017-10-17 00:00:00}) AND (Customers.Ended={ts 2017-10-17 00:00:00}).
What do the curly brackets mean? What does the ts mean?

In my coded snippet I use
ADODB
..Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & DBPath & ";" & _
"Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
How should a simple where statement look like to work in this case?

//Håkan