generali
asked on
VBA/Access hanling apostrophe (')?
I am opening some data in a recordset and that looping through the data and running a simpe update query using docmd.runsql...my problem arises when I come accross a name that has an apostrophe in it i.e. O'Hara, then I receive a run time error. Does anybody know of a way to handle this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
capricorn1-
tried the first one and returned - '" & Nz(rst!Debtor, ") & "' in my sql but replaced the double single quote with space and worked a treat.
Many Thanks
tried the first one and returned - '" & Nz(rst!Debtor, ") & "' in my sql but replaced the double single quote with space and worked a treat.
Many Thanks
Replace(fieldname, "'", "''")
which replaces a single quote with two.