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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

now() built in function, how to use it?

Status
Not open for further replies.

davikokar

Technical User
May 13, 2004
523
IT
Hallo,
I would like a query that returns me the records where a certain field is equal to the today date (short date format).

I'm trying this but strangely it doesn't work:

SELECT blablabl...
WHERE (tbl_Trackedactivity.Tra_Date)=Now();

do you know why?
thanks
 
hi,

Now() includes Date & Time. You could say
[tt]
WHERE (tbl_Trackedactivity.Tra_Date)=Int(Now());
[/tt]


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
still doesnt' work skipvought, do you know if there is another way to transform the now() output into a short format date dd.mm.yyyy?
 
If Tra_Date is defined as a date in the tbl_Trackedactivity table, then you can try this:
WHERE tbl_Trackedactivity.Tra_Date=Format(Date(), "m/dd/yyyy");
If, however, it is defined as a formatted string, you may try this:
WHERE tbl_Trackedactivity.Tra_Date=Format(Date(), "dd.mm.yyyy");
BTW, is tbl_Trackedactivity an genuine Access table or a SQL Server one ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
A DATE is a DATE, which is a NUMBER like NOW is 38194.3501 which can be FORMATTED any which way for DISPLAY purposes.

1. is your DATE a real date?

2. do you have a row with a date equalt to today?

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
I have a field in a ms access table and the field type is date. I choosed the short format to display the date and it returns a date like this: dd.mm.yyyy. So the tra_date are real dates.
 
If by chance the table field also contains time info you may try this:
WHERE CLng(tbl_Trackedactivity.Tra_Date)=CLng(Date());


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top