Add to Combo Box

EliteDesk@aol.com

Registered User.
Local time
Today, 19:00
Joined
Sep 11, 2000
Messages
45
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
 
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
 

Users who are viewing this thread

Back
Top Bottom