validation rule on combo box

  • Thread starter Thread starter KIT LAU
  • Start date Start date
K

KIT LAU

Hi,

I would like to create a validation rule on the values of
the combo box. If the data inputted is not found in the
rowsource of the combo box, error messages will be popped
up.

How can I do that?

Thanks for your help.

Kit Lau
 
This is done for you when you set the LimitToList property
to Yes.

Hope That Helps
Gerald Stanley MCSD
 
In addition to Gerald's answer, use the NotInList Event of the ComboBox if
you want a custom message rather than the default Access message.

Check Access VB Help on the NotInList Event of ComboBox.
 
Thanks. It worked. But how can I bypass the system error
message "The text you entered isn't an item in the list"
and I want to customize the message.

KIT LAU
 
See Access VB Help on the NotInList Event / Event Procedure.

The code should be something like:

****
Private Sub Combo0_NotInList(NewData As String, Response As Integer)
' Display custom dialog box.
MsgBox "Sorry, not in list.", vbOKOnly, "Not In List!"
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
End Sub
****
 
Back
Top