Custom Toolbars

C

Candice

Hi,
I am using Access 2003. When the users log on, I have code to check if they
are a manager or not. If they are, I want to show the Manager menu at the
top. I have created a custom Menu Bar called 'Manager'. On the startup form
I check the logon id and decide whether to show the Menu Bar or not, like
this:

Select Case CurrentUser()
Case "poweruser", "managerid"
gManager = True
CommandBars("Manager").Visible = True
Case Else
gManager = False
CommandBars("Manager").Visible = False
End Select


I get the error: Invalid Procedure call or argument.
What's wrong with this code? The Manager menu sits on a custom toolbar
called "CORP Toolbar". Perhaps I have to reference the CORP Toolbar first
and then the Manager menu?

thanks
 
B

Bernd Gilles

Hi Candice,

you found the answer by yourself ;-)

try:

CommandBars("CORP Toolbar").Controls("Manager").Visible = False
 
C

Candice

Thanks, Bernd; it works like a charm now. Guess I should have gone the extra
step before I posted! I am a VB programmer so sometimes I get that funny
feeling how something probably is done in Access but can't quite get the
syntax!
 

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