From: johnlute on 23 Apr 2010 12:11 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!
From: Dirk Goldgar on 23 Apr 2010 12:15 "johnlute" <jlute(a)marzetti.com> wrote in message news:c051c14c-c2c5-4d36-8089-1e0dd2ac7eab(a)k33g2000yqc.googlegroups.com... > 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. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: johnlute on 23 Apr 2010 12:21 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. On Apr 23, 12:15 pm, "Dirk Goldgar" <d...(a)NOdataSPAMgnostics.com.invalid> wrote: > "johnlute" <jl...(a)marzetti.com> wrote in message > > news:c051c14c-c2c5-4d36-8089-1e0dd2ac7eab(a)k33g2000yqc.googlegroups.com... > > > > > > > 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. > > -- > Dirk Goldgar, MS Access MVP > Access tips:www.datagnostics.com/tips.html > > (please reply to the newsgroup)- Hide quoted text - > > - Show quoted text -
|
Pages: 1 Prev: Getting 'Type mismatch' error after redesigning form Next: Form |