Validation Rule HELP!

summer

Registered User.
Local time
Today, 12:17
Joined
Oct 15, 2001
Messages
65
I am working on a validation rule. I can't figure out what expression to use. I have a form where you type in an item number and all the details for that item pop up into their respective fields. When an item number that is typed in that does not appear in the database, I'd like to have a validation rule pop up saying that number is not in the database. What expression should I use? :confused:

The item number field is a combo box that draws from the item number table.

Thanks for any help!!!
 
Check these two things out under Properties for the Combo Box:

Limit to List
On Not in List
 
customize error message?

Well wasn't that simple! Thanks for your help.

Is there a way to customize the error message?
 
Don't mind helping, but the answer to your question is right there in the Help file. :rolleyes: Under the example for the NotInList event, you will see what you need.
Code:
Private Sub Combo1_NotInList(NewData As String, Response As Integer)
If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
        ' Set Response argument to indicate that data is being added.
        Response = acDataErrAdded
        ' Add string in NewData argument to row source.
        Combo1.RowSource = Combo1.RowSource & ";" & NewData

Else
    ' If user chooses Cancel, suppress error message and undo changes.
        Response = acDataErrContinue
        Combo1.Undo
    End If

End Sub

Let me know if this works for you :)
 

Users who are viewing this thread

Back
Top Bottom