Form opens sometimes when it shouldn't

  • Thread starter Thread starter wkaibigan
  • Start date Start date
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
 
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.
 
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?
 
Back
Top