Securing Objects

  • Thread starter Thread starter Matt Howard
  • Start date Start date
M

Matt Howard

I am trying to secure an administrative form on my
database. I have a main menu with several buttons and
each button operates with a macro. When I adjust
permissions so that our users can't use the admin form, I
get all the prerequisite Access messages, and then I get
the Halt macro window. How can I set up the database so
that the Halt window does not appear?

Thanks in advance,

Matt Howard
 
You really can't deal with that, as long as you use macros.

You can write VBA code to open the forms instead.

Change the On Click event to [Event procedure] and click on the build button
to the right (...)

A code window will open two lines Private Sub... and End Sub. All you need
to do is put
DoCmd.OpenForm "NameOfForm"
between the two lines.

As for limiting users, I'd suggest you use the code in the security FAQ to
determine if a user is in a group. Based on their membership you could just
hide buttons on your main menu. Then you don't have to deal with the
permission denied messages. Also it is nicer for users if they aren't
presented with options they don't have access to.

In the Open Event for your main menu

If faq_IsUserInGroup("GroupName", CurrentUser()) then
me!cmdAdmin.visible = true
Else
me!cmdAdmin.visible = false
End if

Substitute GroupName for the name of your group that should see the admin
form button.
 
Back
Top