Syntax error (missing operator)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that displays a syntax error when I use the double-click
function of a coded combo box:

Syntax error (missing operator) in query expression
'txtProfileID="Pallet 48" X 40"".

The debugger points to this line of code:

DoCmd.OpenForm strFormToOpen, acNormal, _
WhereCondition:="txtProfileID=""" & .Value & """"

I think the problem lies with the use of " in the ID Pallet 48" X 40". If
this is the problem how can I resolve it? If it's not the problem then what
might it be and how can it be resolved?

THANKS for you help!
 
You need to double up the quotes inside the string, i.e.:
"Pallet 48"" X 40"""

Try pasting the function below into a general module.
Save.

Then use like this:
WhereCondition = "txtProfile = "" & DoubleUpQuotes(.Value) & """"

Function DoubleUpQuotes(strIn As String) As String
DoubleUpQuotes = Replace(strIn, """", """""")
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

open report button syntax error 13
double click event to open form where 3
Missing operator Error 4
Syntax Error (Missing Operator) 3
Syntax Error 3
Syntax error (missing operator) 4
Syntax Error 1
Missing Operator 5

Back
Top