View Full Version : Date In Query Question


fenhow
05-15-2008, 06:56 AM
Hi,

I have a query that I am trying to run using a date filter.

I created a form that has an unbound txtbox with a short date format;
the form is called ReportSB the txtbox is called EODDay

In that txtbox the user enters a date.

The query has a date field in it called dateclosed

in the criteria I have; Like "*" & [Forms]![ReportSB]![EODDay]

I want the query to run all records where the date is the same as the one in the EODDay on the ReportSB form.

When I run this it comes up empty.

When I add [Date] in the query and run it it asks me for the date, I type in 5/15/2008 and all the records for 5/15/2008 appear like they should.

Can someone please tell me or help my as to why the query is not using the Like "*" & [Forms]![ReportSB]![EODDay] code?

Thanks.

Fen How

namliam
05-15-2008, 07:07 AM
You want all dates equal to the one entered why use Like at all??

how about just using [Forms]![ReportSB]![EODDay] ??

Basicaly it should work.

fenhow
05-15-2008, 07:27 AM
Thanks, I think that got it however my dates in the table have the date and time versus just the date and that may be killing it.

How can I update / Convert all the dates in that column to just short date no time?

Thanks..
Fen How

namliam
05-15-2008, 11:30 PM
Use the function DateValue(YourDateTimefield) to strip of the time part.
Now you have only the date and you can use = [Forms]![ReportSB]![EODDay]

Or use the criteria function:
between [Forms]![ReportSB]![EODDay] and [Forms]![ReportSB]![EODDay] + #23:59:59#

Either will work

Good Luck !