Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH QUERY CRITERIA

Status
Not open for further replies.

eastmanj

Technical User
Nov 7, 2001
5
US
I am trying to set up a macro that will open a form, then I will input criteria, then it will run another macro in which 5 queries will be run based on the information I input into the form. I have everything setup but two things are wrong. First, when I input the information into the form and click OK, the form executes but the other macro (consisting of the 5 queries) will not run. I have to run it manually. Then, when I run that macro manually, it doesn't identify the records properly. The 5 queries separate my database 5 different types of actions, which is one criteria, and then by the month entered into the form, which is the other criteria. It is sorting them by action, but records from other months are still showing up. I think it may have something to do with the expression I entered as criteria in each of the queries. So I'll list that below:

Like "*" & [FORMS]![MONTHLYREPORT]![Report Month] & "*"

Basically when I log stuff in, I enter the date (i.e. 8 November 2001). The queries are designed to identify every action of a particular type within the specified month. The reason I used wildcards is so it will find all records with the word November in it. But, like I said, it is still finding records from other months.

Please offer any advice you feel will be helpful. I'm getting better at using access but am still a beginner. Thanks.

 
instead of trying to match the string with LIKE etc.
try using the Month() function which returns a number from 1 to 12 for the month part of a date.
For example Month("8 November 2001") will return 11, assuming that Access can interpret dates in that format.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top