Query to search by month .. how do I format???

G

Guest

I have a colum with dates... see example below

11/01/07
11/10/06
01/11/08

I want to build a query that will as for the month. When I enter 11, I want
the
11/01/07 and 11/10/06 to appear but not the 01/11/08.

How do I need to format the query for this to happen?
THANKS! ... Joe....
 
R

raskew via AccessMonster.com

Hi Joe -

Assuming you’re using US Short-Date format (2/1/07 = 1 February 2007), how
‘bout this in the criteria cell of your date field: < dateserial(year(date())
+1, 1,1)

HTH - Bob
 
J

John Spencer

Add a calculated column to your query and search on that column

Field: TheMonthNumber: Month([Your Table].[Your Field])
Table: << BLANK >>
Criteria: 11

That will return all records where the month is November.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Gary Walter

In addition to Bob's sage advice...

It sounds like you want a parameter query
where you want to add a column in the grid like:

(replace "yurdatefield" with field name
of "column with dates")

Field: DateMonth: Month(yurdatefield)
Table:
Sort:
Show: <checked>
Criteria: [Enter Month Number Jan=1,Feb=2,etc]
Or:
 
G

Guest

Hi Bob,

I placed the following in the criteria field:

Like [Enter Month] & DateSerial(Year(Date())+1,1,1)

I was expecting to be able to enter 11 when prompted "Enter Month" and then
all dates with month 11 would be listed. But, all I got was an empty list.

What am I doing wrong? Thanks! Joe...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top