formatting a text box control for use in query criteria?

SirStevie3

Registered User.
Local time
Yesterday, 19:46
Joined
Jul 29, 2013
Messages
58
I have a totals query that provides an avg for each month. i'd like to be able to use a text box control (named "Date") on a form (named "Report Runner") to show only a certain month and it's avg.

I tried using this as criteria on the "MonthGroupPMC" field:
Code:
Format([Forms]![Report Runner]![Date], "yyyy-mm")

but the results came up blank.

how can i filter the results of this query to show only one month, specified by the [Forms]![Report Runner]![Date] control?
 

Attachments

  • MSACCESS2.JPG
    MSACCESS2.JPG
    13.1 KB · Views: 184
  • MSACCESS1.JPG
    MSACCESS1.JPG
    19.2 KB · Views: 180
  • MSACCESS3.JPG
    MSACCESS3.JPG
    29.1 KB · Views: 187
Try this WHERE to your SQL.
Code:
WHERE Month(Date_Sent) = Month([Forms]![Report Runner]![Date]);
 
got an error (attached screenshot)

tried making the Format(Date_Sent,"yyyy-mm") match your Month(Date_Sent) but got the same error...

:(
 

Attachments

  • MSACCESSerror.JPG
    MSACCESSerror.JPG
    11.9 KB · Views: 179
Not for sure but I suspect that the "Date" name cause the troubles.
The "Date" is a reserved word. So, Access expect some arguments after this (reserved) word that you use in the SQL string.
Try to change all names in something like StartDate or EndDate etc.
 
tried changing it to Date1 and Text63 but neither worked.

what is a syntax error anyway?
 
guess i had the SQL statements in the wrong order.

I got it!! thank you guys!
 

Users who are viewing this thread

Back
Top Bottom