Insert, not in list event
Posted on 2013-06-02
Experts, I have the below NOT IN LIST EVENT. I think there is something wrong with the strSQL line. Do you see what it is? When I tab out of the field it doesnt insert.
Private Sub cboRating_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
On Error GoTo EH '<-- add this for error handling
strSQL = "INSERT INTO tblRatings_Combined (Agency, Rating) VALUES (" & Me!cboRatingAgency & ", " & Me!cboRating & ")"
CurrentDb.Execute strSQL, dbFailOnError '<---- Change this line to use strSQL
If IsNull(Me.cboRatingAgency) Then
MsgBox "Enter Rating Agency first", vbInformation
EH: If Err.Number = 3075 Then
'resume next 'don't know what this is for.
ElseIf Err.Number <> 0 Then
MsgBox "Error " & Err.Number & ": " & Err.Description