Hi there,
I have a series of combo boxes on my form. If the user adds a new entry that isn't in the list, a message comes up asking them if they want to add it, but if they select 'No', the error message "The text you entered isn't an item in the list..etc" pops up.
I'd like to suppress this message, OR edit it (a message is fine, but this one is unclear and repetitive).
So, ideally I'd like a message to appear remindning the user to add something from the list, and then, once they say OK, have the code clear the combo box ready for a new selection.
Does anyone have any suggestions?
Here is my code:
Private Sub Categories_NotInList(NewData As String, Response As Integer)
Dim strSQL1 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 in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Category")
If i = vbYes Then
strSQL1 = "Insert Into tblCategories ([Category]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL1, dbFailOnError
Response = acDataErrAdded
End If
End Sub