Query by Date

  • Thread starter Thread starter DCost
  • Start date Start date
D

DCost

I have a field that is listed Review Month, the date has
to be inputed 03/04 (cannot be March 2004). When I try to
run a query and select 03/04 in criteria field, it does
not bring up any records. What do I need to do to correct
this? Thanks
 
Dear D:

Is Review Month a column in a table? Is it a text value?

If it is text, your query must say:

WHERE [Review Month] = '03/04'

If it says:

WHERE [Review Month] = 03/04

then it will divide 3/4. So, this is the same as saying:

WHERE [Review Month] = .75

Probably not what you mean, but computers are very literal.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
I have a field that is listed Review Month, the date has
to be inputed 03/04 (cannot be March 2004). When I try to
run a query and select 03/04 in criteria field, it does
not bring up any records. What do I need to do to correct
this? Thanks

A date field must be entered as a full, valid date.
Entering 03/04 is not a valid date. Access will automatically assume
you are entering 03/04 of the current year, i.e. March 4, 2004.

You must enter 3/1/04 or better yet 3/1/2004 as a date.
You can then Format the date to show just the month and year if you
wish.

As criteria for your query, you would add another column ..
GetMonth:Format([DateField],"mm/yy")

As Criteria for this column you would write:
[Enter Month/Year]

Now you can enter 03/04 and have the query return the appropriate
records for March 2004.

P.S. You might want to use "m/yy" as the format, so that you could
simply enter 3/04 instead of having to enter 03/04.
 
Back
Top