View Full Version : Add to Combo Box


EliteDesk@aol.com
09-12-2000, 07:30 AM
If a user does not choose an item from the combo box, just types in something. Is there a way to detect this and then add the text entered to the combo box. THANKS!

Cathi

chrismcbride
09-12-2000, 09:41 AM
Try the 'Not In List' event... ie...

Private Sub id_string_NotInList(NewData As String, Response As Integer)

If MsgBox("The Value -- " & NewData & " -- that you have entered into the " _
& "Purchase Order Type field " _
& "is currently not a valid PO Type. Would you like to add it to the List " _
& "for future use?", vbYesNo, "New Purchase Order Type?") = vbYes Then

Response = acDataErrAdded
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblPrefix (prefix) VALUES ('" & NewData & "');"
DoCmd.SetWarnings True
Else
Response = acDataErrContinue
Me.id_string.Undo
End If

End Sub