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

"Syntax Error (missing operator) in query expression"

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.