Code:
sqlAdd = "Insert into [contacts] ([CONT_TYPE], [INC_OUT], [FACILITATOR], [CONT_PERSON], [PREM_ID], [CONT_DTTM], [NOTES], [OUTCOME] ) " & _
"VALUES ('" & v_cont_type & "', '" & v_inc_out & "', '" & v_facilitator & "', '" & v_cont_person & "', '" & v_prem_ID & "', #" & v_cont_dttm & "#, '" & v_cont_notes & "', '" & v_cont_outcome & "' ) "
DoCmd.RunSQL sqlAdd
All the variables in the "value" section of the SQL are coming from the values in text/combo boxes on a form.
When "v_cont_notes" has an apostophe in it, for example, "Pharmacist said there wasn't a problem", then the code keels over with a syntax error.
Can anyone think of a work-around?