Syntax Errors - Apostrophe in field value

systemx

Registered User.
Local time
Tomorrow, 03:14
Joined
Mar 28, 2006
Messages
107
Hi all,

If a field value contains an apostrophe (') eg "Bob's Factory" - when performing a lookup (and I would assume when using any SQL) a syntax error is generated.

Just wandering whether there is a way you can work around this in your code - or some type of global function that can be written to ignore the apostrophe if it occurs within a string?

Hope this makes sense.

Cheers

Rob
 
I always use this to do my searching..

Replace(string,"'","''")

Replace one ' with two ''

Then the SQL statement sees that as an apostraphe and enables u to search correctly
 
The problem is that you are using a single quote to delimit your search string. Using Chr(34) instead will eliminate this problem and no replace is necessary.
 

Users who are viewing this thread

Back
Top Bottom