472,143 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 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 14868
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Petr Prikryl | last post: by

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.