This has to be an easy question

dragonsbb16

New member
Local time
Today, 06:41
Joined
Apr 17, 2006
Messages
3
i have a access application that does a simple filter

here is my code..

dim filter as a sting

filter = "CenterName = '" & NameSel.Value & "'"

DoCmd.OpenForm FormName
DoCmd.ApplyFilter , filter
DoCmd.close acForm, FormName2

This function works fine UNTIL
NameSel.Value = "Adult's"

And the reason is b/c there is a single quote in the value...what is the best way to solve this? Any help would be great. thanks.
 
dragon,

filter = "CenterName = """ & NameSel.Value & """

Wayne
 
You need a 5hit load of double quotes: (extra spaces added for clarity)
Code:
filter = "CenterName = " " " & NameSel.Value & " " " "

I just realized that Wayne Ryan already answered this question on one of your (triplicate) posts.
 
Last edited:
I just realized that sergeant added a much-needed double-quote at
the end of my example.

Thanks Sarge,
Wayne
 

Users who are viewing this thread

Back
Top Bottom