Try changing it to:
SQLInsertStr = "Insert Into EmailHistory (UniqueID, Date, MailFrom, MailTo, Subject, Body, EmailType) VALUES (" + ;
Cstr(nextUniqueID) + ",'" + Cstr(Now()) + "','" + FromValue + "','" + ToValue + "','" + ;
SubValue + "',?BodyValue,'" + EmailTypeValue + "')"
BodyValue is actually the variable name with a ? that will make SQL Server evaluate it at insertion time and not during variable initialization.
>Larry you are right,
>
>this is what I am doing.
>SQLInsertStr = "Insert Into EmailHistory (UniqueID, Date, MailFrom, MailTo, Subject, Body, EmailType) VALUES (" + Cstr(nextUniqueID) + ",'" + Cstr(Now()) + "','" + FromValue + "','" + ToValue + "','" + SubValue + "','" + BodyValue + "','" + EmailTypeValue + "')"
>
>objConnection.execute SQLInsertStr
>
>The bodyValue is the part that contain " and '
>How could I build the string for this situation?
>
>Thanks a lot.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao