paremiter query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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]
 
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.
 
Back
Top