View Single Post
  #2 (permalink)  
Old May 11th, 2006, 11:50 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yes, I do this a lot with contracted solutions. The idea is that in VBA, it is "Lite" security since it can be hacked pretty easy.

Create a table with Groups. Then create a table with usernames, passwords and whatever information for the user, and a GroupID FK. This is your access structure.

Be sure to hide menus when the database is opened.

The first form is modal/pop up, and asks for login credentials. Use Password formatting for the password field on the form and in the table. This form then checks the tables for proper authentication matches, and then opens a hidden form with username and group.

All the rest of your forms should refer to the hidden forms for proper access. What I do is segregate functions on seperate forms, and then unhide linking buttons based on the user's group credentials.

For each of your events, you have the option of going out and checking the group on the form, like this:

If [Forms]![frmHIDDENLogin].[Groups] = "Administrator" Then
   DoCmd.OpenReport 'etc
   Else
   MsgBox "You do not have access to this report." & vbCrLf & _
          "Please see the database Administrator for access."
End If

That sort of thing.

If [Forms]![frmHIDDENLogin].[Groups] = "Administrator" Then
   Me.btnAdminForm.Visible = True
   Else
   Me.btnAdminForm.Visible = False
End If

Is this helpful?



mmcdonal
Reply With Quote