DLookup

  • Thread starter Thread starter johnlute
  • Start date Start date
J

johnlute

Access 2003

I posted this at the tail end of an earlier thread but since it's
about a very different issue I thought it made sense to post it here.

I've tossed in a DLookup into the following:

If fOSUserName = DLookup("txtUserName", "tblUserNames") Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "Sorry! You are not allowed to use this form.",
vbCritical, vbOKOnly
DoCmd.CancelEvent
End If

This won't work UNLESS the table being looked up only has ONE user
name recorded. If I add more than one user name to the table then I
get the "not allowed" error message.

This isn't what I expect from DLookup - or am I way off base...?

Thanks!
 
johnlute said:
Access 2003

I posted this at the tail end of an earlier thread but since it's
about a very different issue I thought it made sense to post it here.

I've tossed in a DLookup into the following:

If fOSUserName = DLookup("txtUserName", "tblUserNames") Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "Sorry! You are not allowed to use this form.",
vbCritical, vbOKOnly
DoCmd.CancelEvent
End If

This won't work UNLESS the table being looked up only has ONE user
name recorded. If I add more than one user name to the table then I
get the "not allowed" error message.

This isn't what I expect from DLookup - or am I way off base...?

Thanks!


Does my reply in the other thread clarify it for you? If you give no
criteria to DLookup, it just looks at the first (abritrarily selected)
record in the table.
 
Hi, Dirk.

Your response to the other thread was entirely helpful - thanks! I
posted this one in an attempt to keep the other thread from getting
messy - but I think I've made a mess, anyway!

Thanks!

Please disregard this thread.
 
Back
Top