finding current usergroup

Cereldine

Registered User.
Local time
Today, 02:11
Joined
Aug 4, 2005
Messages
71
I have been doing some research on the currentuser() function and basing events on its value.

I have been testing around the following

If CurrentUser() = "manager" Then
Me.tabHide.Visible = True

End If

My understanding is that if a user called "manager" is logged in the tab will become visible.

What would i have to do if i wanted to make the tab visible based on the group a user is in rather than their log in name? e.g. bill and john are both managers that need to see that particular tab but have different usernames?
 
You could create a table with your uesr name in and also a level column
ie jbloggs admin
sjones manager

On login you can select the level from the table wher the currentUser = the user name in the table

Then if level = manager button is visible
elseif level = Admin all buttons available
etc
end if

Hope this help
 
I'm attaching an example if you want to look at it. I has tables, switchboard, switchboard table as well as mods that run it. It may contain info you are needing.
 

Attachments

Using CurrentUser() requires using Access security. I don't particularly like Access security. I find it cumbersome. You can do the same thing using Environ("Username"). This functions returns the network login ID for the PC. You would then go with something like Smart recommended, where you retrieve the level from the table based on the loginID. For example:

If DLookUp("[Level]","tblUsers","[LoginID] = '" & Environ("Username") & "'") = "Manager" Then
Allows access
Else
Deny access
End If
 

Users who are viewing this thread

Back
Top Bottom