Hi everyone. I have an unbound form in which a user enters data relating to a credit dispute, and when they hit the Save button I have a sub that is intended to insert that data into a table. This is a bit out of my comfort zone, so I found some code from another forum and adjusted it to my needs. However, I'm getting errors.
The table name is tbl_complaints. The fields from the form are:
txtAcctNumber
txtClient
txtEoscarType
txtEoscarControl
cboMethodReceipt
txtReceivedFrom
txtReceivedDate
txtDateDue
txtResponseDate
cboResponseType
cboDispute1
cboDispute2
txtAddComments
txtNotes
cboProcessor
txtProduct
cboTypeComplaint
cboStatus
cboCode
My code is below.
The error I get is error number 3075, and it says I'm missing an operator in the section that references cboResponseType, but I can't seem to figure out what I'm missing. My head is spinning from staring at these parentheses and apostrophes for so long, so I'm hoping that someone with a bit more expertise in this area can lead me in the right direction.
I appreciate any help you have to offer!
And I'd very much like to avoid a discussion about the evils of unbound forms, but I'll take the tongue-lashing if the result is a working sub.
The table name is tbl_complaints. The fields from the form are:
txtAcctNumber
txtClient
txtEoscarType
txtEoscarControl
cboMethodReceipt
txtReceivedFrom
txtReceivedDate
txtDateDue
txtResponseDate
cboResponseType
cboDispute1
cboDispute2
txtAddComments
txtNotes
cboProcessor
txtProduct
cboTypeComplaint
cboStatus
cboCode
My code is below.
Code:
Private Sub cmdSave_Click()
Dim StrSql As String
On Error GoTo ErrorHandler
StrSql = "INSERT INTO tbl_complaints " _
& "(ACCT_NUMBER, CLIENT_NAME, EOSCAR_TYPE, EOSCAR_CONTROL_NUMBER, METHOD_OF_RECEIPT, RECEIVED_FROM, " _
& "DATE_RECEIVED, DATE_DUE, RESPONSE_DATE, RESPONSE_TYPE, DISPUTE1, DISPUTE2, CLIENT_COMMENTS, NOTES, " _
& "PROCESSOR, PRODUCT, TYPE_OF_COMPLAINT, STATUS, CODE_1 ) " _
& "VALUES (" _
& txtAcctNumber & ", '" _
& txtClient & "', '" _
& txtEoscarType & "', '" _
& txtEoscarControl & "', '" _
& cboMethodReceipt & "', '" _
& txtReceivedFrom & "', #" _
& txtReceivedDate & "#, #" _
& txtDateDue & "#, #" _
& txtResponseDate & "#, '" _
& cboResponseType & "', '" _
& cboDispute1 & "', '" _
& cboDispute2 & "', '" _
& txtAddComments & "', '" _
& txtNotes & "', '" _
& cboProcessor & "', '" _
& txtProduct & "', '" _
& cboTypeComplaint & "', '" _
& cboStatus & "', " _
& cboCode & ");"
DoCmd.SetWarnings False
DoCmd.RunSQL StrSql, 0
DoCmd.SetWarnings True
ExitCode:
Exit Sub
ErrorHandler:
MsgBox "Error adding record. " & vbCrLf & "Error Number: " & Err.Number & vbCrLf & " Description: " & Err.Description
Resume ExitCode
End Sub
The error I get is error number 3075, and it says I'm missing an operator in the section that references cboResponseType, but I can't seem to figure out what I'm missing. My head is spinning from staring at these parentheses and apostrophes for so long, so I'm hoping that someone with a bit more expertise in this area can lead me in the right direction.
I appreciate any help you have to offer!
And I'd very much like to avoid a discussion about the evils of unbound forms, but I'll take the tongue-lashing if the result is a working sub.