Not In List

  • Thread starter Thread starter Doc
  • Start date Start date
D

Doc

With a field set as combo box, the option exists for a "Not In List" event.
I wrote some code to pop up a message, but when the user closes the message,
the generic access error message also pops up.

How do I stop that from happening?
 
You need to ensure that you're setting the value of Response properly in the
NotInList routine. Valid values are:

acDataErrDisplay: The Default value, which displays the default message to
the user.

acDataErrContinue: Doesn't display the default message to the user. You can
use this when you want to display a custom message to the user.

acDataErrAdded: Doesn't display a message to the user but enables you to
add the entry to the combo box list in the NotInList event procedure. After
the entry is added, Microsoft Access updates the list by requerying the
combo box. Microsoft Access then rechecks the string against the combo box
list, and saves the value in the NewData argument in the field the combo box
is bound to. If the string is not in the list, then Microsoft Access
displays an error message.
 
Oh man, I don't have a clue what that means. . .

Are you saying I need to put that in the NotInList box, or include it
somewhere in the function I wrote?
 
What do you currently have for the NotInList event?

Assuming it's a Event Procedure, it's probably something like:

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

MsgBox "Hey, that's not a good value!"

End Sub

You need to change that to

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

MsgBox "Hey, that's not a good value!"
Response = acDataErrContinue

End Sub
 
Back
Top