Good Morning
I am hoping someone can help me locate where this error may be... I am getting a syntax error when I try to execute... it has not given me an error when writing the code and it steps through both lines fine with all values OK when viewing in the immediate window. Then when it steps down to the execute it tells me there is a syntax error in the INSERT INTO statement... I cannot see where
Here is my code...
Sub InsertCorrespondence()
lsSQL = ""
lsSQL = lsSQL & " INSERT INTO Tbl_Correspondence ( DiaryActionID, CompanyRef, CorrType, Contact, Date, Time, Notes, CreatedBy, CreatedWhen ) "
lsSQL = lsSQL & " VALUES ( '" & txtDiaryActionID.Value & "', " & ICompanyRef & ", '" & lstCorrType.Value & "', '" & CboContact.Value & "', '" & Date & "', '" & txtTime.Value & "','" & txtNotes.Value & "', " & SUser & ", " & Now() & ")"
CurrentDb.Execute lsSQL
End Sub
I am hoping someone can help me locate where this error may be... I am getting a syntax error when I try to execute... it has not given me an error when writing the code and it steps through both lines fine with all values OK when viewing in the immediate window. Then when it steps down to the execute it tells me there is a syntax error in the INSERT INTO statement... I cannot see where
Here is my code...
Sub InsertCorrespondence()
lsSQL = ""
lsSQL = lsSQL & " INSERT INTO Tbl_Correspondence ( DiaryActionID, CompanyRef, CorrType, Contact, Date, Time, Notes, CreatedBy, CreatedWhen ) "
lsSQL = lsSQL & " VALUES ( '" & txtDiaryActionID.Value & "', " & ICompanyRef & ", '" & lstCorrType.Value & "', '" & CboContact.Value & "', '" & Date & "', '" & txtTime.Value & "','" & txtNotes.Value & "', " & SUser & ", " & Now() & ")"
CurrentDb.Execute lsSQL
End Sub