Here's some more code I use at the end of the login code I already posted:
' if password or User ID not correct, give user a total of 4 tries to get it right, then quit application
lngTries = lngTries + 1
If lngTries = 4 Then DoCmd.Quit
Else
Me.txtPassword = ""
Me.txtUserID = ""
MsgBox "Invalid log in. Try again"
Me.txtUserID.SetFocus
Exit Sub
End If
Make a macro called Autoexec that calls the login form to always start the login.
On your main menu form open property, add this code:
if strUserID < "0" then
msgbox "You did't log in!"
docmd.Quit
end if
In the same place on any forms as appropriate you can, for example, only display buttons to certain group(s). For example, a button cmdAdmin on the main menu is only for members of the admin group. Put in this code as part of OnOpen form property:
if strUserGroup = "Admin" then
me.cmdAdmin.visible = True
else
me.cmdAdmin.visible = False
end if
You should set the visible property of those types of controls on forms, etc., to false when you design the form, so it normally is not visible.
Once you've got the login working well, doing the rest really isn't very complicated.Just keep the number of groups down to a small number. You could even include in the table listing the groups some columns that indicate various areas of access that you could just look up for a form, etc., and act appropriately. Using that concept you could have, for example, 10 different areas of concern and the mix of rights could be different but overlapping for the different groups. If you need that complexity, that would be the simplest solution to allow yourself real control while limiting the code necessary in the forms.
Good luck.