Validation Rule HELP! (1 Viewer)

summer

Registered User.
Local time
Today, 00:59
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!!!
 

pdx_man

Just trying to help
Local time
Yesterday, 16:59
Joined
Jan 23, 2001
Messages
1,347
Check these two things out under Properties for the Combo Box:

Limit to List
On Not in List
 

summer

Registered User.
Local time
Today, 00:59
Joined
Oct 15, 2001
Messages
65
customize error message?

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

Is there a way to customize the error message?
 

pdx_man

Just trying to help
Local time
Yesterday, 16:59
Joined
Jan 23, 2001
Messages
1,347
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 :)
 

summer

Registered User.
Local time
Today, 00:59
Joined
Oct 15, 2001
Messages
65
pdx_man,
Thanks for your help!
summer
 

Users who are viewing this thread

Top Bottom