PC Review


Reply
Thread Tools Rate Thread

Apostrophe in field causes error

 
 
neeley
Guest
Posts: n/a
 
      24th Jun 2004
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TURX?=
Guest
Posts: n/a
 
      24th Jun 2004
stLinkCriteria = "[FacilityName]=" & "'" & Replace(Me!
[FacilityName],"'","''") & "'"


"neeley" wrote:

> 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.
>
>

 
Reply With Quote
 
neeley
Guest
Posts: n/a
 
      24th Jun 2004
Thank you for the help. It did the trick.
>-----Original Message-----
>stLinkCriteria = "[FacilityName]=" & "'" & Replace(Me!
>[FacilityName],"'","''") & "'"
>
>
>"neeley" wrote:
>
>> 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.
>>
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Names in 'to' field in sent items displays as apostrophe's =?Utf-8?B?QW5keSBDb2xsaW5z?= Microsoft Outlook Discussion 1 4th Oct 2007 03:56 PM
Using apostrophe causes syntax error in text field =?Utf-8?B?WFA=?= Microsoft Access Form Coding 2 19th Feb 2007 11:35 PM
Apostrophe in entry in an input field =?Utf-8?B?TGVhcm5lcjQw?= Microsoft Access 1 3rd Dec 2005 02:56 PM
apostrophe in text field causing unexpected error Richard Hollenbeck Microsoft Access Queries 1 5th Oct 2004 07:06 PM
Apostrophe in a text field causes error in query Alp Microsoft Access Queries 9 6th Sep 2004 07:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:58 PM.