467,075 Members | 986 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

2 custom menu bars, depending on permissions?

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 <CTRLand 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

Jan 30 '07 #1
  • viewed: 2159
Share:
5 Replies
ps - I am using Microsoft Access 2003, and I have checked "Microsoft
Office 11.0 Object Lib" in References.

Jan 30 '07 #2
lorirobn wrote:
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.

--
Tim

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Jan 30 '07 #3
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!

Jan 30 '07 #4
lorirobn wrote:
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).
What you should do when dragging built-in menu items from the various
types of existing menu controls, is hold the control key before you do this.

IOW, when in menu customization, create a new menu (or tool) bar. If
all you want is, for example, the cut menu control, hold down your
control key and then drag the cut control from the actual built-in menu
to the new menu/tool bar. You won't hurt anything existing that way! 8)

I'm not 100% certain if disabling a copy of a built-in item like this
will affect the original - I don't think it will, but try it. If it
does, you'll need to make your own edit function and set it up as the
onaction property, ie =fMyFunction().

BTW, presumeably you know how to reset the default menu configuration
when it gets unintentionally changed the way you describe?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Jan 31 '07 #5
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

Jan 31 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by Wayne | last post: by
1 post views Thread by rdemyan via AccessMonster.com | last post: by
6 posts views Thread by Neil | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.