[AccessD] Handle quotes (') in strings

Dan Waters dwaters at usinternet.com
Thu Dec 28 09:00:51 CST 2006


Hi Sander,

You can use the Replace function. Try this:

	stgStringVariable = "'s-hertogenbosch"

	stgSQL = "INSERT INTO tblTest (FieldName)" _
		& " VALUES('" & Replace(stgStringVariable, "'", "''") & "')"
	Docmd.RunSQL stgSQL


Dan Waters

-----Original Message-----
Subject: [AccessD] Handle quotes (') in strings

Hi group,

I need to insert several strings in a table.
These strings CAN contain quotes ('). Does anybody have a routine lying
around that handles these quotes?

e.g. I need to insert values like:
's-hertogenbosch

I need this urgently!!

TIA!!!

Sander


PS Sorry for being so blunt...



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list