Double Quote (") problem in SQL expressions in MS Access form filter

Dear experts,

I need to use field values, selected by user from a combo box of all values in a field,
to filter the records showed in a form, like that:
Forms(frm.Name)![subfrm].Form.Filter = strSQL
were strSQL is somethink like:
(([ACCOUNT_NAME] LIKE "SomeCompany""))
I have a problem with double quotes inside the string.
How can I submit in SQL expressions a string with double quotes inside it?

Thanks and tell me if the points are enough.
prismabiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BillystyxCommented:
I think a / before the " sorts that out

Billystyx
0
BillystyxCommented:
alternatively, &"""" &"SomeCompany &""""
billystyx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shanesuebsahakarnCommented:
Alternatively, when you build the SQL string:

strSQL="[ACCOUNT_NAME] Like """ & Replace(strCompany,"""","""""") & """"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

cstahlbergCommented:
also a:

 & chr(132)

would add in a quote to  string...

0
prismabiAuthor Commented:
Actually the best answer for me is from shanesuebsahakarn
thanks to you. I'm looking for more answers from you.
0
prismabiAuthor Commented:
I suggest declaring:
Const QUOTE = """"

so the syntax is more friendly:
strSQL="[ACCOUNT_NAME] Like """ & Replace(strCompany,QUOTE ,"""""") & QUOTE

Thanks again to all experts.
0
BillystyxCommented:
Is there any difference in points between accepted answer and assisted here? If so, I think you can swap them round ...

Billystyx

0
prismabiAuthor Commented:
That's the first time I grant points here, so I'm not sure if they were splited as i wanted:
75 to Billystyx
50 to shanesuebsahakarn

>you wrote: you can swap them round
Sorry but i don't understand what you mean.


0
prismabiAuthor Commented:
shanesuebsahakarn,
thanks again for your very good answer.
It worth more points than I gave you!
The next time i'll add 250 points to your answer.

0
BillystyxCommented:
sorry, I just thought you meant that you intended to give shane the higher cut - so I was suggesting you could get it changed that way if that was what you meant, but I'm sure Shane doesn't mind anyway for the difference of 25 points:)

Billystyx

0
shanesuebsahakarnCommented:
It's not like I need them :)
0
BillystyxCommented:
That's very true!
Billystyx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.