Here is the VBA:
Private Sub cmdSaveRecord_Click()
Dim dbs As Database
Dim sSQL As String
Dim strMsg As String
Set dbs = CurrentDb
sq = Chr$(39) 'single quote
sSQL = "UPDATE tblECLUData " _
& "SET (State = " & sq & txtState & sq & "," _
& "ClaimStatus = " & sq & cboClaimStatus & sq & "," _
& "ECLUAnalyst = " & sq & cboLITRep & sq & "," _
& "ECLUMgmt = " & sq & cboECLUMgmt & sq & "," _
& "Insured = " & sq & cboRptType & sq & "," _
& "LitAssoc = " & sq & cboLitAssoc & sq & "," _
& "AsgmntRec = " & sq & txtAsgmntRec & sq & "," _
& "ClmFileSnt = " & sq & txtClmFileSnt & sq & "," _
& "LitAnalystCal = " & sq & txtLitAnalystCal & sq & "," _
& "AsgmntClo = " & sq & txtAsgmntClosed & sq & "," _
& "TMDiaryDate = " & sq & txtDiary & sq & ")" _
& "WHERE ClaimNumber = '" & cboFind.value & "'"
'add/update data to tblECLUData
If DCount("*", "tblECLUData", "ClaimNumber = '" & Me.txtClaimNumber.value & "'") = 0 Then 'record does not exist
'insert record
dbs.Execute " INSERT INTO tblECLUData (State , ClaimNumber , ClaimStatus, ECLUAnalyst, ECLUMgmt, Insured, ReportType, LitAssoc, AsgmntRec, ClmFileSent, LitAnalystCal, AsgmntClo, TMDiaryDate) " & _
" VALUES('" & Me.txtState & "','" & Me.txtClaimNumber & "','" & Me.cboClaimStatus & "','" & Me.cboLITRep & "','" & Me.cboECLUMgmt & "','" & _
Me.txtIns & "','" & Me.cboRptType & "','" & Me.cboLitAssoc & "','" & Me.txtAsgmntRec & "','" & _
Me.txtClmFileSnt & "','" & Me.txtLitAnalystCal & "','" & Me.txtAsgmntClosed & "','" & Me.txtDiary & "')"
Else
'record exists
Debug.Print sSQL
dbs.Execute sSQL, dbFailOnError
End If
strMsg = "Data successfully entered into database."
MsgBox strMsg, vbOKOnly, "Entry Successful"
End Sub
This is what the debug.print displayed:
UPDATE tblECLUData SET (State = 'Alabama',ClaimStatus = 'Closed',ECLUAnalyst = 'Dan Einslinger',ECLUMgmt = 'Allen Shockey',Insured = 'Supplemental Report',LitAssoc = 'Alice Urome',AsgmntRec = '6/27/2016',ClmFileSnt = '6/27/2016',LitAnalystCal = '6/27/2016',AsgmntClo = '6/27/2016',TMDiaryDate = '6/27/2016')WHERE ClaimNumber = '01-234N-958'
The debug.print seems to be displaying all of the information on the form, but it still doesn't update the record. The "Run-time error '3144': Syntax error in UPDATE statement" still comes up.