I have a Note box on a form that deals with Franchisees. It allows that I can add new notes for different call dates. Each Note has it's own id. These can only be added and not editted. I have a second form that has something similar however, these notes can be editted later. Here is where the problem is. I am unable to add a new note. My SQL for the editting/updating of a note works, however I receive the "Run-time error -2147217900(80040e14)':
Syntax Error in INSERT INTO statement"
The SQL for INSERT INTO statement for the Franchisee works correctly:
If varFranchNotes(0) = 0 Then
strSQL = "INSERT INTO tblFranchNotes (FNDate, Notes, Fid)" & _
"VALUES('" & _
varFranchNotes(1) & "','" & _
varFranchNotes(2) & "', " & _
varFranchNotes(3) & "
"
End If
The one that doesn't work is as follows:
If varDateNotes(0) = 0 Then
strSQL = "INSERT INTO tblStoreOpenDate (OpenDate, Note, Sid)" & _
"VALUES('" & _
varDateNotes(1) & "','" & _
varDateNotes(2) & "'," & _
varDateNotes(3) & "
"
Else
'create sql for updating record
strSQL = "UPDATE tblStoreOpenDate SET " & _
"tblStoreOpenDate.OpenDate = " & "'" & varDateNotes(1) & "', " & _
"tblStoreOpenDate.Note = " & "'" & varDateNotes(2) & "', " & _
"tblStoreOpenDate.Sid = " & varDateNotes(3) & _
" WHERE ODid = " & varDateNotes(0)
End If
As I mentioned before, the UPDATE works, however, for whatever reason, the INSERT INTO statement doesn't.
Any help would be greatly appreciated. I am going nutz trying to figure this out (I am not the greatest coder in the world).
Regards,
ambra19
Syntax Error in INSERT INTO statement"
The SQL for INSERT INTO statement for the Franchisee works correctly:
If varFranchNotes(0) = 0 Then
strSQL = "INSERT INTO tblFranchNotes (FNDate, Notes, Fid)" & _
"VALUES('" & _
varFranchNotes(1) & "','" & _
varFranchNotes(2) & "', " & _
varFranchNotes(3) & "
End If
The one that doesn't work is as follows:
If varDateNotes(0) = 0 Then
strSQL = "INSERT INTO tblStoreOpenDate (OpenDate, Note, Sid)" & _
"VALUES('" & _
varDateNotes(1) & "','" & _
varDateNotes(2) & "'," & _
varDateNotes(3) & "
Else
'create sql for updating record
strSQL = "UPDATE tblStoreOpenDate SET " & _
"tblStoreOpenDate.OpenDate = " & "'" & varDateNotes(1) & "', " & _
"tblStoreOpenDate.Note = " & "'" & varDateNotes(2) & "', " & _
"tblStoreOpenDate.Sid = " & varDateNotes(3) & _
" WHERE ODid = " & varDateNotes(0)
End If
As I mentioned before, the UPDATE works, however, for whatever reason, the INSERT INTO statement doesn't.
Any help would be greatly appreciated. I am going nutz trying to figure this out (I am not the greatest coder in the world).
Regards,
ambra19