Query Search

Pappy

Registered User.
Local time
Today, 09:59
Joined
Jun 12, 2003
Messages
28
I need the user to input a month such as 1 for January, but the query needs to pull the month inputted and the next month. How do I code this without asking the user for 2 monthes. I'm a newbie, be kind. Thanks
 
Put a hidden control on your form. When the user enters a month into the field use code to enter the next month in the hidden control (you have to use code because if the user enters 12 you don't want to put 13 in the hidden field but 1. And becareful about the year as the example here will crosses a year boundry). Now in the criteria line of your query use code like this:

Between [Forms]![NameOfForm]![ControlUserEnteredDateInto] And [Forms]![NameOfForm]![HiddenControlWithNextMonth]

I don't know how you have your field set up in your query but you can use the Month() function to get the month number value of a date in your query (2 = February, etc.).

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom