Board index » delphi » Date parameters in MS Access 97

Date parameters in MS Access 97

I have a form with a couple of  TDateTimePickers.  I would like to use a
TStringList to dynamically write the query for a report.  However I cannot
get the dates parameters to work.  I've tried the following where dteStart
is the name of my TDateTimePicker:

SQLstrings.Add('tblBusPlan.DateDue>#'  +
formatDateTime('dd/mm/yy',dteStart.Date)+ '#');

but when I add the strings to a TQuery and call the open method I get an
error message from the BDE.

Anyone know the correct syntax for Date parameters against a MS Access 97
database using ODBC and the latest BDE driver (sorry can't remenber the
exact dll name but it is the latest native access driver for the BDE).

Thanks
Bill N

 

Re:Date parameters in MS Access 97


Quote
>SQLstrings.Add('tblBusPlan.DateDue>#'  +
>formatDateTime('dd/mm/yy',dteStart.Date)+ '#');

>but when I add the strings to a TQuery and call the open method I get an
>error message from the BDE.

>Anyone know the correct syntax for Date parameters against a MS Access 97
>database using ODBC

If you are using ODBC drop the # character and use Single quotes to delimit your
dates

SQLstrings.Add('tblBusPlan.DateDue> '  +
QuotedStr(formatDateTime('dd/mm/yy',dteStart.Date));

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads