paremiter query

S

Sarah Stockton

I have a table that has a date field, ie 12/01/2004. I want to query the
table based on a month and year that the user gives. So that the return value
would be all the enteries for the month of December in 2004. How do I ask for
that type of paremeter?

Thank you
 
R

Rick B

Add a new column to your query with the following:

MonthAndYear: Format([YourDateFieldNameHere],"MMYY")



Under it (in the criteria section) put...

=[EnterMonth and Year as MMYY]


If you don't want it to show in your query results, uncheck the SHOW box.


Rick B
 
J

John Vinson

I have a table that has a date field, ie 12/01/2004. I want to query the
table based on a month and year that the user gives. So that the return value
would be all the enteries for the month of December in 2004. How do I ask for
that type of paremeter?

Thank you

Rick's suggestion is one way; another (which will take advantage of an
index on the date field) is

BETWEEN DateSerial([Enter four digit year:], [Enter month number:], 1)
AND DateSerial([Enter four digit year:], [Enter month number:] + 1, 0)

John W. Vinson[MVP]
 
S

Sarah Stockton

Thank you.

I will try both ways, I may end up liking one more than the other.

I apoligize for the double post, the submit screen said that my post didn't
go through. I didn't realize that it did.
 

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