2 custom menu bars, depending on permissions?

L

lorirobn

Hi,

I am trying to create two custom menu bars for my application, one for
read-only users (without delete record), and one for update-access
users (with delete record).

I only need File and Edit options. File will be the same on both, but
Edit will have different options.
When I create an Edit menu on the custom menu bar, and then modify it,
it seems to also be changing the Edit menu on the other custom menu,
AND the Edit menu on the default Menu Bar. I'm thoroughly confused!

This is my first attempt at creating menu bars. Here are the steps
I've been following:
From Tools, I go to Customize, New. I change the property from
Toolbar to Menu Bar. I copy the Edit Menu from my default menu bar on
the top of the page by pressing <CTRL> and EDIT and dragging it to my
new custom menu bar. I drag unnecessary items off the new custom Edit
menu. But then when I look at either the first custom menu bar I
created or my default one on top, they are both missing all the items
I dragged off.

Can you have several Edit menus with different options, and display
just one at a time?

I want to have 2 custom menu bars, then in my startup VBA, use just
one depending on the user's permissions. I have that all coded, but
it's the creation of the custom menu bars that I seem to be struggling
with.

Many thanks -
Lori
 
L

lorirobn

ps - I am using Microsoft Access 2003, and I have checked "Microsoft
Office 11.0 Object Lib" in References.
 
T

Tim Marshall

lorirobn said:
I am trying to create two custom menu bars for my application, one for
read-only users (without delete record), and one for update-access
users (with delete record).

It's been a little while since I used mdws and I'm at home away from my
work where I have secured Jet apps.

But rather than two separate menu bars, my approach would be to have
one. This makes it much easier to maintain, IMO.

Your startup form or code in your autoexec macro could have code similar
to the following air code. It assumes the menu bar is called "mnuMain"
and that the delete control is the third menu item along mnuMain:

Select case Currentuser 'or group identifier
Case "Full Access User1", "Full Access User2", etc
Commandbars("mnuMain").Controls(3).Enabled = true
Case else 'Read only user/group
Commandbars("mnuMain").Controls(3).Enabled = false
end select

You should not rely on this code however, just in case there is some
kind of odd unanticipated occurance that has the delete menu control
enabled for read only users. You can include code in your delete
function that is assigned to the onaction property of the control item 3
to check the user and display "You cannot delete these records" or
something in a message box. Of course, your permissions would take care
of this sort of thing.
 
L

lorirobn

Hi Tim,

Thanks - that is really helpful. I didn't know I could disable an
item on a menu drop-down.
However, it still leaves me with the other problem I'm encountering.
When customizing a new menu, as I alter the new menu, I seem to also
be altering my original menu bar. I feel I am doing something wrong,
but what?
For example, I create a new menu bar called Test1. On it, I have File
and Edit. On Edit, I delete everything except one item, "Cut" (just
as an example). When I look at my original main menu bar, the Edit
menu has lost everything except "Cut". So now the main Menu Bar's
Edit menu matches my new custom Test1 Edit menu. Or at least the
main menu bar that I am looking at on my window (although if exit
Access and come back in and disable Test1, the main Menu Bar is as it
should be, with all options).

I hope this makes sense!
 
L

lorirobn

Hi Tim,
I received your email after I got help from a co-worker, and now
realize I was setting up my new menu incorrectly. I was not using the
"create a new menu" option! Instead, I was just dragging (while
holding control key) the Edit menu. This was the big "aha" moment!
Create a New Menu is the last option within the Commands Tab on the
Customize pop-up. I didn't know about this.

Soooo... all is working fine now. Thank you so much for your help. I
will take your advice and only use one menu bar, and dim the one item
that's not used by everyone, too.

Lori
 

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

Similar Threads


Top