Insert statement - apostraphe in value

bugsy

Registered User.
Local time
Today, 02:52
Joined
Oct 1, 2007
Messages
99
Hi

I have an insert statement on a form

Code:
    sSql = "Insert Into ChangeHistory  VALUES ('" & Group_Contact.Value & "', '" & ID.Value & "','" & ctrl.Name & "','" & ctrl.OldValue & "','" & Value & "', '" & User & "','" & Now & "')"
    CurrentDb.Execute sSql

What should for it to accept value with apostraphe (') in them ?

I can replace them with blank stirngs, bet athats not really solution..

Code:
    Value = ctrl.Value
    Value = Replace(Value, "'", "")
 
Double up the single ticks!
Value = Replace(Value, "'", "''")
 

Users who are viewing this thread

Back
Top Bottom