Tool/Menubars depending on login name

O

OzPete

Season's Greetings All,

I have seen before how to determine the workgroup login name using code....
but I have forgotten it - can someone pls remind me?

Secondly, I have two logins for the workgroup:

User
Admin

Can one use the login name to do the following?

If I am [User] then I don't get to see any toolbar, or any menubar but the
custom menubar which we shall call for now "IdiotsGuide"

If I am [Admin] then I get to see all default toolbars and default Access
Menubar....

Is there a way of coding this when the database starts up?

Naturally any really in-depth VBA code supplied in replies automatically
puts you on my Christmas Card list <g>

OzPete
 
N

Nikos Yannacopoulos

OzPete,

You could try the following code:

Sub toolbars()

If Application.CurrentUser = "Admin" Then
restore_toolbars
Exit Sub
End If

For Each cmdb In Application.CommandBars
If cmdb.Visible = True Then cmdb.Visible = False
Next

Application.CommandBars("IdiotsGuide").Visible = True

End Sub

Sub restore_toolbars()

Application.CommandBars("Database").Visible = True
Application.CommandBars("Menu Bar").Visible = True
Application.CommandBars("IdiotsGuide").Visible = False

End Sub

Sub Toolbars should be fired by the Autoexec macro.

I would suggest using some event to fire restore_toolbars
before exit regardless of user, so next time Access is run
(any database) it starts with the default toolbars.

If you would like to take this a step further, you could
use a few more lines of code to store each user's default
toolbars (either in an Access table or in a hidden text
file on their C:\ drive), and restore back to each user's
settigns rather than the general default above.

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top