Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / January 2007

Tip: Looking for answers? Try searching our database.

2 custom menu bars, depending on permissions?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lorirobn - 30 Jan 2007 16:08 GMT
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
lorirobn - 30 Jan 2007 16:14 GMT
ps - I am using Microsoft Access 2003, and I have checked "Microsoft
Office 11.0 Object Lib" in References.
Tim Marshall - 30 Jan 2007 21:13 GMT
> 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

Signature

Tim   http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto

lorirobn - 30 Jan 2007 23:08 GMT
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!
Tim Marshall - 31 Jan 2007 03:46 GMT
> 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?
Signature

Tim   http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto

lorirobn - 31 Jan 2007 16:40 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.