Assuming the ID field is a numeric type, I think I would do
it like this:
If DCount("*", "User", "ID=" & Me.S_User) = 0 Then
MsgBox "Invalid user ID" & vbCrLf & "Try again"
Cancel = True
End If
But if you prefer:
If IsNull(DLookup("ID", "User", "ID=" & Me.S_User)) Then
. . .

Signature
Marsh
MVP [MS Access]
>Thank you for your help and the quick response time!
>I understand everything you are telling me but I am having trouble with the
[quoted text clipped - 32 lines]
>> subform of the user table's form, the LinkMaster/Child
>> properties would natually lead to only valid entries.
David Bowling - 22 Feb 2005 13:49 GMT
Marshall,
I used the following syntax as a condition in a macro.
DLookUp("Id","User","Id= [Forms]![Scan Form].[S_User]") Is Null. This works
great!. The macro allows me to open a form (with a timer) to display a user
friendly error message, then close the form, change the focus back to user id
field and clear the invalid data. This way, the fork-lift operators will not
have to get down off their truck to use the mouse to clear an error. This
really makes the interface user friendly!
Thanks again. You rock!
Dave
> Assuming the ID field is a numeric type, I think I would do
> it like this:
[quoted text clipped - 44 lines]
> >> subform of the user table's form, the LinkMaster/Child
> >> properties would natually lead to only valid entries.