Hi All,
I have an Access database and using ADOQuery, Delphi 6 Pro:
I have a field called 'ExpireDate' in Access I have set this to a ShortDate.
I want to only display records in a dbgrid where the expiredate is less than todays date.
I have looked at previous posts on the forum but they do not work. Here is my code:
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM TestTable WHERE ExpireDate < ' +FormatDateTime('mm"/"dd"/"yyyy', Now));
Open;
end;
I have tried formatting the date (as above) as I've read that SQL stores the date in US format, does that make a difference? My computer is set to UK dd/mm/yyyy
Thanks for your time and help.
I have an Access database and using ADOQuery, Delphi 6 Pro:
I have a field called 'ExpireDate' in Access I have set this to a ShortDate.
I want to only display records in a dbgrid where the expiredate is less than todays date.
I have looked at previous posts on the forum but they do not work. Here is my code:
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM TestTable WHERE ExpireDate < ' +FormatDateTime('mm"/"dd"/"yyyy', Now));
Open;
end;
I have tried formatting the date (as above) as I've read that SQL stores the date in US format, does that make a difference? My computer is set to UK dd/mm/yyyy
Thanks for your time and help.