Missing operator

thart21

Registered User.
Local time
Today, 09:37
Joined
Jun 18, 2002
Messages
236
I am getting a Missing Operator message when running this from a command button on my form.
stDocName = "OpenContracts"
strWhere = "WHERE tblContracts.closed = False AND"
strWhere = strWhere & " (tblContracts.preparer) = '" & Me.cboOwner & "' AND"

Have also tried
stDocName = "OpenContracts"
strWhere = "WHERE tblContracts.closed = False AND"
strWhere = strWhere & " (tblContracts.preparer) = '" & Me.cboOwner & "'"

with the same results.

cboOwner is a combo box and tblContracts.closed is a radio button.

Complete error message:

Syntax error (Missing operator) in query expression 'WHERE tblContracts.closed = False AND (tblContracts.preparer) = 'Koul"

Any ideas?

Thanks,

Toni
 
thart21 said:
I am getting a Missing Operator message when running this from a command button on my form.
stDocName = "OpenContracts"
strWhere = "WHERE tblContracts.closed = False AND"
strWhere = strWhere & " (tblContracts.preparer) = '" & Me.cboOwner & "' AND"

Have also tried
stDocName = "OpenContracts"
strWhere = "WHERE tblContracts.closed = False AND"
strWhere = strWhere & " (tblContracts.preparer) = '" & Me.cboOwner & "'"

with the same results.

cboOwner is a combo box and tblContracts.closed is a radio button.

Complete error message:

Syntax error (Missing operator) in query expression 'WHERE tblContracts.closed = False AND (tblContracts.preparer) = 'Koul"
Any ideas?

Thanks,

Toni

You may need an extra " before the
Code:
'" & Me.cboOwner & "'"
, if you look Koul has a single qoute before and double after. That looks like that is where the problem lies.

Try that.
Code:
"'" & Me.cboOwner & "'"
 
Thanks for the reply. This makes too many " and then comments out the line after the '

strWhere = strWhere & " (tblContracts.preparer) = " '" & Me.cboOwner & "'"

I also tried to add another " after strWhere & " which caused the same error message.

Thanks,

Toni
 
thart21 said:
Thanks for the reply. This makes too many " and then comments out the line after the '

strWhere = strWhere & " (tblContracts.preparer) = " '" & Me.cboOwner & "'"

I also tried to add another " after strWhere & " which caused the same error message.

Thanks,

Toni

Sorry,

I am sure that the quote is the problem. I can tell by the way it is viewing the word Koul.

Have you tried.
Code:
strWhere = strWhere & " (tblContracts.preparer) = '"" & Me.cboOwner & "'""

Hopefully soon someone will come rescue you.

Sorry I wasn't more help.
 
If you are opening a form or report then you do *not* include the word "WHERE" in your WhereClause. It is supplied later by Access.
 
Last edited:
Thanks RuralGuy - another thing I've learned here!

Toni
 
bound column

It could be a problem with the combo box's bound column. If the bound column is a unique identifier and not the string your looking for then your essentially sending a number as a string.

You can explicity state the column to pull data from with the following syntax.

cbo.column(1). The numbering is 0 based.

If you have apostrophes in the supplied string it will also through things off. In these cases I've found the quad quotes to work the best (e.g. """" [string] """")
 

Users who are viewing this thread

Back
Top Bottom