Form opens sometimes when it shouldn't

W

wkaibigan

Hi

I have the following piece of code in the Switchboard that prevents a
non Admin user from opening the Administation form. For the most part
it works as it should but, every now and again, the form is opened.
Using debug.print, I checked the value returned by the
IsUserInGroupList function and it returns false as it should do. Does
anyone know of any reason why this behaviour is happening or any
possible fixes? Thanks.

If Not IsUserInGroupList(CurrentUser, "Admins") And rs![Argument] =
"frmStartupOptions" Then
MsgBox "Sorry but you don't have permission to view this form"
Else
DoCmd.OpenForm rs![Argument]
End If
 
W

wkaibigan

It appears that this problem happens only once after the database has
been opened. Once the form has been shown that one time, it is then
blocked as it should be with subsequent attempts to open it. If I
close and re-open the database, then the form will again open.
 
K

Keith Wilby

wkaibigan said:
Hi

I have the following piece of code in the Switchboard that prevents a
non Admin user from opening the Administation form. For the most part
it works as it should but, every now and again, the form is opened.
Using debug.print, I checked the value returned by the
IsUserInGroupList function and it returns false as it should do. Does
anyone know of any reason why this behaviour is happening or any
possible fixes? Thanks.

If Not IsUserInGroupList(CurrentUser, "Admins") And rs![Argument] =
"frmStartupOptions" Then
MsgBox "Sorry but you don't have permission to view this form"
Else
DoCmd.OpenForm rs![Argument]
End If

Why not just set that user's security permissions such that they can't open
it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top