W
WestWingFan
I'm trying to code the not in list event of a combo box. I keep getting the
"Invalid procedure call or argument" error. I have the combo box properties
set to Limit to list, the row source set to Table/Query. The bound column is
1 (autonumber) and the table only has one other field. So, except for the
error, I think I'm doing everything right. What did I miss? Thanks in advance
for the help!
Private Sub JCTARSectionLayer1ID_NotInList(NewData As String, Response As
Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Layer...")
If i = vbYes Then
strSQL = "Insert Into tblJCTARSectionLayer1 ([SectionLayer1Text]) "
& _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
"Invalid procedure call or argument" error. I have the combo box properties
set to Limit to list, the row source set to Table/Query. The bound column is
1 (autonumber) and the table only has one other field. So, except for the
error, I think I'm doing everything right. What did I miss? Thanks in advance
for the help!
Private Sub JCTARSectionLayer1ID_NotInList(NewData As String, Response As
Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Layer...")
If i = vbYes Then
strSQL = "Insert Into tblJCTARSectionLayer1 ([SectionLayer1Text]) "
& _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub