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

Using NOW in report

Status
Not open for further replies.

jen1701

Programmer
Dec 20, 2003
57
US
I would like to print a daily report without asking the user to enter the date by using NOW in the query.
In the report query, in the date field, the criteria is like *formatdatetime(now,dd/mm/yyyy)*. So the report will print all the records with that date. It seems I have problem with the criteria I entered. Can someone give any ideas how to get this right? Please Help!

Thank you very much in advance.

Jen
 
Try something like this:
Code:
Format(Date(),"dd/mm/yyyy")

Hoc nomen meum verum non est.
 
Hi CosmoKramer,

Thank you for the reply. When I use expression as Format(Date(),"m/dd/yyyy") or (Now(),"m/dd/yyyy"), the result is 2/27/04. In my query, if I enter the date criteria as Like "*2/27/2004*", I got all the records for 2/27/04. But If I use
Like "*Format(Date(),"m/dd/yyyy")*" or Like "*Format(Now(),"m/dd/yyyy")*" , I get Syntax error. Do you have any idea what should I change?

Thank you very much for your help.

Jen
 
Depending on the regional settings of your PC you might not need any formatting, and definitely no wildcards.

Try simply this: Date() as your date field criteria...

Hoc nomen meum verum non est.
 
Hi CosmoKramer,

Thank you for spending time help me out. The reason I use wildcards is that there are time on my date data. In order to pull out all the records for the day, I have to put something: like *2/27/04". If I put Date() as my date field criteria in my query, there are no records listed. Any ideas how to achieve this?

Thanks,

Jen
 
Jen,

I didn't know the date was in the General date format. Try this in your query:
Code:
Between (Date() & " 00:00 ") And (Date() & " 23:59")

Hoc nomen meum verum non est.
 
Or you could add another column to your query that is your date field formatted:

Format([YourDateField],"mmddyyyy")

The criteria for that field would be:

Format(Date(),"mmddyyyy")

That should give you everything from today.

Kevin
 
Hi CosmoKramer and Kevin,

Thank you very much for your replies. I tried your suggestions. They both worked the way I wanted. Thank you ever so much for the help.

Jen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top