Specific Groups Open Specific Forms

roystreet

Registered User.
Local time
Yesterday, 22:28
Joined
Aug 16, 2004
Messages
47
Hello,
In my database, I use Access security - As it has grown new types of log on features need to be added. Currently, a user logs on and then it goes to a form that has an on timer event of which attempts to open a form that only the admin group can open. So if they do not have permission to open this form then the on error statement kicks in and sends them to a different form. What I want to do is something like this:

if user group = "Admin" then
DoCmd.OpenForm "DAA-MainContents", acNormal, "", "", , acNormal
End if

if user group = "LR Tester" then
DoCmd.OpenForm "DAA-Welcome", acNormal, "", "", , acNormal
End if

I don't believe the above code works, but it's the idea I'm trying to go with. I can use CurrentUser() to determine where they go, but every time I add an user or delete one, I have to go into the code and I would rather it be based on group, not specific user.

Thanks,
---roystreet
 
I suggest that you rethink the way you have your groups defined. You should create workgroup names and passwords for a specific user "workgroup" [not the user]. You can determine who the user is by their network name.

If you created workgroup names like "JoeBlows" & "JoeClerks" then you could use the CurrentUser() function to determine which group the user belongs to. Then you can use the Environ("UserName") to determine who that person is [when you need that info].

Then this would work for you...
Code:
If CurrentUser = "JoeBlows" Then
     DoCmd.OpenForm "DAA-MainContents", acNormal, "", "", , acNormal
ElseIf CurrentUser = "JoeClerks" Then
     DoCmd.OpenForm "DAA-Welcome", acNormal, "", "", , acNormal
Else
     DoCmd.OpenForm "MainMenu", acNormal, "", "", , acNormal
End if
Do NOT use the group name Admin since that is the Access default with full permissions.

Just for fun...
Code:
MsgBox "Current User = " & Environ("UserName")
 

Users who are viewing this thread

Back
Top Bottom