Apostrophe in field causes error

  • Thread starter Thread starter neeley
  • Start date Start date
N

neeley

I have code that asks for two fields that match. The
field contains names with apostrophes. What syntax cloaks
the apostrophe, so VB doesn't think it is a single quote?

stLinkCriteria = "[FacilityName]=" & "'" & Me!
[FacilityName] & "'"

The error states: Syntax error (missing operator) in query
expression [FacilityName]= 'Big D's Bar & Grill"

Any help would be appreciated.
 
Thank you for the help. It did the trick.
-----Original Message-----
stLinkCriteria = "[FacilityName]=" & "'" & Replace(Me!
[FacilityName],"'","''") & "'"


neeley said:
I have code that asks for two fields that match. The
field contains names with apostrophes. What syntax cloaks
the apostrophe, so VB doesn't think it is a single quote?

stLinkCriteria = "[FacilityName]=" & "'" & Me!
[FacilityName] & "'"

The error states: Syntax error (missing operator) in query
expression [FacilityName]= 'Big D's Bar & Grill"

Any help would be appreciated.
.
 
Back
Top