PC Review


Reply
Thread Tools Rate Thread

apostrophe in name

 
 
Ann
Guest
Posts: n/a
 
      2nd Feb 2004
I have a search form, user need to enter first name or
last name, then hit search button, then it will search in
a table.
But when user enter first name like O'henry, which
includes a apostrophe, the it gives error: missing
operator, syntax error.

How can I avoid this problem?

part of codes like:

FullName = "'" & Trim$(Me.txtLName) & ", " &
Trim$(Me.txtFName) & "'"

Thanks
 
Reply With Quote
 
 
 
 
John Vinson
Guest
Posts: n/a
 
      2nd Feb 2004
On Mon, 2 Feb 2004 13:20:57 -0800, "Ann"
<(E-Mail Removed)> wrote:

>I have a search form, user need to enter first name or
>last name, then hit search button, then it will search in
>a table.
>But when user enter first name like O'henry, which
>includes a apostrophe, the it gives error: missing
>operator, syntax error.
>
>How can I avoid this problem?
>
>part of codes like:
>
> FullName = "'" & Trim$(Me.txtLName) & ", " &
>Trim$(Me.txtFName) & "'"
>
>Thanks


Use doublequote characters to delimit the string rather than
singlequotes. A doublequote is represented by TWO doublequotes within
a string constant, or using its ASCII value 34:

FullName = """" & Trim(Me.txtLName & ", " & Trim(Me.txtFName) &
Chr(34)

(actually I'd use one syntax or the other, just showing both as
examples).

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 
Reply With Quote
 
Ann
Guest
Posts: n/a
 
      2nd Feb 2004
Thanks, it works

>-----Original Message-----
>On Mon, 2 Feb 2004 13:20:57 -0800, "Ann"
><(E-Mail Removed)> wrote:
>
>>I have a search form, user need to enter first name or
>>last name, then hit search button, then it will search

in
>>a table.
>>But when user enter first name like O'henry, which
>>includes a apostrophe, the it gives error: missing
>>operator, syntax error.
>>
>>How can I avoid this problem?
>>
>>part of codes like:
>>
>> FullName = "'" & Trim$(Me.txtLName) & ", " &
>>Trim$(Me.txtFName) & "'"
>>
>>Thanks

>
>Use doublequote characters to delimit the string rather

than
>singlequotes. A doublequote is represented by TWO

doublequotes within
>a string constant, or using its ASCII value 34:
>
>FullName = """" & Trim(Me.txtLName & ", " & Trim

(Me.txtFName) &
>Chr(34)
>
>(actually I'd use one syntax or the other, just showing

both as
>examples).
>
> John W. Vinson[MVP]
> Come for live chats every Tuesday and Thursday
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.
>

 
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
Add apostrophe Tony Wainwright Microsoft Excel Programming 5 10th Sep 2010 01:44 PM
Apostrophe DROITE --> Apostrophe COURBE Clarabellas Microsoft Word Document Management 3 10th Jul 2009 07:17 PM
apostrophe key JudyMassey Microsoft Outlook Discussion 1 28th Jun 2009 08:16 PM
apostrophe key karen Microsoft Word Document Management 1 26th Mar 2009 10:04 PM
apostrophe key Vickie Wedow Microsoft Outlook Discussion 0 15th Jul 2003 08:58 PM


Features
 

Advertising
 

Newsgroups
 


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