>I am doing an insert:
>
>sSql = "Insert " & _
> "Into GWC.Cert_Agnc_Hldr " & _
> "(agnc_num, hldr_name) " & _
> "Values('" & sAgncNum & "', '" & sDsplyName "')"
>
>The problem is that I ran across a value for sDsplyName that was: Mac's.
>when it runs into this particular value for name, it gives me an error because of the apostrophe. Is there any way to do this without removing the ' from Mac's?
>Thanks,
>Ryan Uhl
To what database are you inserting to? In SQL Server you can double up single quotes in SQL statements to get just one inserted, so you could probably check for the existence of them with Instr() and if there are then you can use Replace() to double them up before adding it to the sSql string like so:
If Instr(myValue, "'")<>0 Then
myValue = Replace(myValue, "'", "''")
End If
sSql = .. etc.
If it isn't SQL Server then this might not work. HTH