Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare a date field

Status
Not open for further replies.

filipe26

Programmer
Mar 17, 2003
152
PT
Hi i want to compare a date field from the current date.How do i do that in a query?I use paradox through BDE.Thanks.
 
hi,

A query could look like this:

select * from table where datefield = Cast('04-19-2004' as Date)

hope this helps

Steph [Bigglasses]
 
compare a date field from the current date

You want to see if a field in your table matches today's date?

with qryName do
begin
SQL.Clear;
SQL.Add('SELECT * FROM TABLE WHERE FIELDNAME = ' + FormatDateTime('mm/dd/yyyy', Today));
Active := True;
end;

To see if a field in the query matches today then:

with qryName do
begin
SQL.Clear;
SQL.Add('SELECT * FROM TABLENAME');
Active := True;
if FieldByName('DATEFIELD').AsDate = Today then
begin
//do something
end;
end;

Does that help?

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top