By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,779 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,779 IT Pros & Developers. It's quick & easy.

Getting a Syntax Error - You may have entered an operand without an operator

P: 1
Trying to create a report from a Query "MonthlyReportQ" where there is a Modified Date field called [DateModified].

I need the query to filter Dates by Month and Year. To show only the records with the Dates that fall under the Month and Year selected by 2 ComboBoxes ("ReportMonth"&"ReportYear") in Form "MonthlyReportSelection".

I am getting an error with this: (and don't know what is wrong)
Expand|Select|Wrap|Line Numbers
  1. Where Format([DateModified],"yyyymm")=[Forms]![MonthlyReportSelection]![ReportMonth] & [Forms]![MonthlyReportSelection]![ReportYear]
Please Help!!
Thank You!
Dec 13 '13 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 5,397
How about that... I have an example SQL that will do just that for you in thread and post: how-assign-previous-record... POST#23

Look at line#67 at how the zsqlpayment string is formed... line#71 has the start of the WHERE clause that will have the filter set. Note the use of the Year() and Month() and the placment of the date litteral "#" without the "#" then "12/13/2013" becomes a division problem!!!!
Feel free to copy and paste the where clause and alter for your table.

One thing of note:
I usually pull the value of controls into variables that are type cast to the correct type (ie long, double, date) because they are usually easier to type than the control reference and I usually test for null and/or zero length values.

Dec 13 '13 #2

Expert Mod 15k+
P: 31,489
You format the value as Year then Month, but compare it to Month then Year ;-)
Dec 13 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.