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
|