473,396 Members | 1,773 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.

"Syntax Error (missing operator) in query expression"

Hi

I have the following error message "Syntax Error (missing operator)
in
query expression" occurring when I am trying to update combo box
within a form.
My code is:
Dim strSQL As String
Me.DESCRIPTION.Value = ""
strSQL = "SELECT DISTINCT [Description] FROM tblAnzsic_Codes_Info
WHERE Industry = '" & Me.INDUSTRY & "' AND Sub_Division = '" &
Me.SUB_DIVISION & "' AND Group = '" & Me.GROUP & "'"
Me.DESCRIPTION.RowSource = strSQL
This code is produce a list in the "Description" combo box based upon
the values selected in the previous combo boxes.
Any help would be appreciated.

Sep 28 '07 #1
4 14978
On 28 Set, 03:58, thebarefootnat...@googlemail.com wrote:
Hi

I have the following error message "Syntax Error (missing operator)
in
query expression" occurring when I am trying to update combo box
within a form.

My code is:
Dim strSQL As String

Me.DESCRIPTION.Value = ""
strSQL = "SELECT DISTINCT [Description] FROM tblAnzsic_Codes_Info
WHERE Industry = '" & Me.INDUSTRY & "' AND Sub_Division = '" &
Me.SUB_DIVISION & "' AND Group = '" & Me.GROUP & "'"
Me.DESCRIPTION.RowSource = strSQL

This code is produce a list in the "Description" combo box based upon
the values selected in the previous combo boxes.

Any help would be appreciated.


Try placing quotes around strSQL and also
enclosing Group in brackets: [Group].

(There might be other unbalanced stuff. Did not try it)

Me.DESCRIPTION.RowSource = strSQL does not look right (unless you want
a boolean there)
perhaps you meant & "DESCRIPTION=""" & strSQL & """" (?)

-P
----------------------------------------------------------------------
Acces Reports / Dashboards / Charts / Alerts ...
http://groups.google.it/group/DataTime

Sep 28 '07 #2
th***************@googlemail.com wrote in
news:11*********************@22g2000hsm.googlegrou ps.com:
Hi

I have the following error message "Syntax Error (missing
operator)
in
query expression" occurring when I am trying to update combo box
within a form.
My code is:
Dim strSQL As String
Me.DESCRIPTION.Value = ""
strSQL = "SELECT DISTINCT [Description] FROM tblAnzsic_Codes_Info
WHERE Industry = '" & Me.INDUSTRY & "' AND Sub_Division = '" &
Me.SUB_DIVISION & "' AND Group = '" & Me.GROUP & "'"
Me.DESCRIPTION.RowSource = strSQL
This code is produce a list in the "Description" combo box based
upon
the values selected in the previous combo boxes.
Any help would be appreciated.
If the strSQL definition is all on one line it should work. (I can't
tell from here as my reader wraps text.)

Before setting the rowsource, do a debug,print strSQL. that will
show the string in the immediate window, {Ctrl-G} to make it visible
and examine the string to see if there are any missing spaces, or
other issues.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 28 '07 #3
On Sep 28, 8:17 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:
thebarefootnat...@googlemail.com wrote innews:11*********************@22g2000hsm.googlegr oups.com:


Hi
I have the following error message "Syntax Error (missing
operator)
in
query expression" occurring when I am trying to update combo box
within a form.
My code is:
Dim strSQL As String
Me.DESCRIPTION.Value = ""
strSQL = "SELECT DISTINCT [Description] FROM tblAnzsic_Codes_Info
WHERE Industry = '" & Me.INDUSTRY & "' AND Sub_Division = '" &
Me.SUB_DIVISION & "' AND Group = '" & Me.GROUP & "'"
Me.DESCRIPTION.RowSource = strSQL
This code is produce a list in the "Description" combo box based
upon
the values selected in the previous combo boxes.
Any help would be appreciated.

If the strSQL definition is all on one line it should work. (I can't
tell from here as my reader wraps text.)

Before setting the rowsource, do a debug,print strSQL. that will
show the string in the immediate window, {Ctrl-G} to make it visible
and examine the string to see if there are any missing spaces, or
other issues.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com- Hide quoted text -

- Show quoted text -
Hi,

I tried using the quotes around strSQL and brackets around Group but
it don't work.

My str SQL code is all one line.

Dim strSQL As String

Me.DESCRIPTION.Value = ""
strSQL = "SELECT DISTINCT [Description] FROM tblAnzsic_Codes_Info
WHERE Industry = '" & Me.INDUSTRY & "' AND Sub_Division = '" &
Me.SUB_DIVISION & "' AND Group = '" & Me.GROUP & "'"
Me.DESCRIPTION.RowSource = strSQL

Any other ideas?

Thanks

Oct 1 '07 #4
On Oct 1, 1:18 am, thebarefootnation
<thebarefootnat...@googlemail.comwrote:
Any other ideas?
The problem seems to be caused by having a field called "Group" in
your table. I made a test form with two textboxes and a combobox and
got the same error you got. When I changed the table design field
name to theGroup and changed the references on the form appropriately
the RowSource worked. Note: I put the RowSource change in the form's
Current event.

James A. Fortune
CD********@FortuneJames.com

Oct 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current situation: try... (Python 2.4 (#60, ...)) >>> i =...
5
by: deko | last post by:
After developing an MDB in Access 2003 on WS03, then making it into an MDE and deploying it on a WinXP box with Access 2003 installed, I get this error: Function is not available in expressions...
4
by: James | last post by:
Please help me with this sql: SELECT z005aNORTHEAST_3days_Formula.Region, z005aNORTHEAST_3days_Formula.DiffofClaimsAssignment FROM (SELECT .Region, (.)-( .) AS DiffofClaimsAssignment FROM...
2
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a...
13
by: hn.ft.pris | last post by:
Hi: I have the following simple program: #include<iostream> using namespace std; int main(int argc, char* argv){ const double L = 1.234; const int T = static_cast<const int>(L); int arr;
2
by: sfrvn | last post by:
I am embarrassed to say I cannot make this work. Recently upgraded to Access 2003, but do not know if that part of problem (AKA 'syntax change'). Would someone be kind enough to lead me by the...
7
by: luttkens | last post by:
I used to have no problems using IF-statement in SQL-queries. Now nothing works, it always returns "Syntax error". This query also returns an error. IF (1=1) THEN SELECT 'True' ELSE SELECT...
2
by: RAG2007 | last post by:
Hi, I'm running an ADP with SQL Server as back end. On a main form, my subform is coming up blank. When I was running as an mdb with no back end I didn't have this problem. I get an error "Syntax...
0
by: Daniel Halvorse | last post by:
hi I am working on an application that manages the data in a access database. but i cant seem to get past this error. When i try to run it it says: "Syntax error in INSERT INTO statement" syntax...
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
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.