Creating a query on the fly and getting an error message

J

John

It say thats I am missing an operator. The problem is
that one of the fields that person chooses to search by
looks like this:

Galyan's Sport and Outdoor

In my code I reference a combobox to get the value to put
in my where clause:

where = where & " AND [User3]= '" + Me![Client] + "'"

Me![Client] is the variable from the combobox. I have to
use single quotes for the code to recognize the value is a
variable. The problems is the query think the "'"
in "Galyan's" is the missing operator. If I manually put
double quotes in it works.

Is there some sort of work around to put double quotes in
the code and still get the value of the combo box. I
could not think of a way.

Thanks,
John
 
T

TPratt

I'm sure there's a better way than the way I've found, but my way does work.

where = where & " And [User3] = " & """" & Me![Client] & """"

For whatever reason, it likes the 4 quotes as shown above.
 

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

Top