473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
2 3782
zmbd
5,501 Expert Mod 4TB
eagle1468
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.

-z
Dec 13 '13 #2
NeoPa
32,556 Expert Mod 16PB
You format the value as Year then Month, but compare it to Month then Year ;-)
Dec 13 '13 #3

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

Similar topics

1
by: jayj0nes | last post by:
I'm querying a Mas90 db via ADO in Access. The following SQL gives me the error "Invalid Operand for Operator: =" "SELECT * from GL_DetailPosting where PostingDate >= '#01/01/2004#'" These other...
2
by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
18
by: rahuls | last post by:
Hi everyone, I have a couple of questions? 1.this is part of my main function ////////////////////////////// int main() { FILE *f1; int i,j; j=100000000; int intData;
7
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
0
by: dougancil | last post by:
I have the following code: Imports System.Data.SqlClient Public Class Main Protected WithEvents DataGridView1 As DataGridView Dim instForm2 As New Exceptions Private Sub...
1
by: Michael Taylor | last post by:
What is wrong with this sql statement? ORA-06550: line 1, column 9: PLS-00103: Encountered the symbol "01" when expecting one of the following: begin function pragma procedure subtype type current...
1
by: mertsenel | last post by:
if (comboBox1.Enabled == true && textBox5.Text != "") { OleDbConnection con = new OleDbConnection(); con.ConnectionString =...
6
by: ahakrush | last post by:
hey, i have been writing this code (C++) in the last week, i have many classes in the .h file, but one problem with one class, which is: ___________________________________________________________...
1
by: Zakir1994 | last post by:
#include <iostream> using namespace std; void getLength(); void getWidth(); void getArea(); void getdisplayData(); int main() { // Get the rectangle's length. {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.