How to choose only one month?

maquino

New member
Local time
Today, 19:05
Joined
Mar 8, 2002
Messages
8
I believe this is a pretty simple question. I want to be able to choose a specific month to be displayed on my query(wich contains the field "date") when I open it. I only want to display the records on that specific month, and I want access to ask me wich month I want to display every time I run the query.
Someone help me please!
 
Not too difficult to do this: Add the following field to the query: Month([Date]) where [Date] is your date field. Then, in the criteria line of that field add the following parameter: [Enter Month]. What this will do is prompt the user with "Enter Month" when they run the query, and will only display records from that month. Note: the month value is a 1 or 2 digit number (1=January, 12=December, etc.) so that you might want to include that in your parameter (eg, [Enter 1- or 2-digit Month (eg, 1=January, 2=December, etc.)]. Whatever you type within the parameter brackets will be the text displayed when the user is prompted.

[This message has been edited by brucesilvers (edited 03-08-2002).]
 
First of all, I would avoid 'date' as a field name as it is also a function name. Lets assume you are using [TheDate]

Do you want to the user to input a value from 1 to 12?

Are you looking for data only in the current year, or all years for that month?


Assuming the user in going to enter a number from 1 to 12 and you want ALL records for that month, regardless of year:


Under TheDate criteria in the design grid, try:
DatePart("m",[TheDate]) = [Enter month number]
 
Yeah, you're right, I forgot to teel you that I'd also want to specify the year, not just the month. How can I do that?
 
Make a separate field with the same structure, except use Year() as your function and, obviously, the word in your parameter.
 

Users who are viewing this thread

Back
Top Bottom