PC Review


Reply
Thread Tools Rate Thread

Apostrophe in query, probably an easy one but urgent...

 
 
JustinP
Guest
Posts: n/a
 
      6th Sep 2006
I'm created a query from whatever the user passes through textboxes.

Sometimes these have apostrophes... As an example, O'KEEFE is entered
into the textbox...

This is part of the code
strSQL = Update ...(omited)... MasterTable.OWNER1_SURNAME = '" &
Replace(txtOWNER1_SURNAME, "'", "' & '")

Evaluates to:
MasterTable.OWNER1_SURNAME = 'O' & 'KEEFE'

How can I handle these apostrophes and account for null text boxes if
they exist?

 
Reply With Quote
 
 
 
 
JustinP
Guest
Posts: n/a
 
      6th Sep 2006
I've also tried using:

IIf(txtOWNER1_SURNAME Is Not Null, (Replace(txtOWNER1_SURNAME, "'",
"''")), "")

 
Reply With Quote
 
JustinP
Guest
Posts: n/a
 
      6th Sep 2006
I sorted it...

Just use:

& Chr$(34) & txtOWNER1_SURNAME &Chr$(34)

Then puts double qoutes around txtOWNER1_SURNAME (e.g. "O'BRIAN")

 
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
Foolproof Query on Quote and Apostrophe Text? David Kaye Microsoft Access 1 14th May 2011 02:21 PM
ADO Access Query bombs when data has apostrophe =?Utf-8?B?S2VuIFZhbGVudGk=?= Microsoft Excel Programming 1 1st May 2007 10:32 PM
SqlDataAdapter Parameterized Query - Apostrophe Issue herlihyboy Microsoft VB .NET 2 28th Mar 2006 02:48 PM
Error 3075 occurs when doing query with apostrophe =?Utf-8?B?dUdlaw==?= Microsoft Access VBA Modules 1 22nd Nov 2005 02:08 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.