473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

It always dims the wrong menu item!

Hi everybody,

I got the code for dimming a menu item from this group after looking
for it for a long time thanks to those who share their experiences with
the others :)

The problem I'm facing is that it dims the wrong menu item!! Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the 3rd
command in the 2nd menu!! It's driving me crazy!

Thanks for your time and help :)

Lou

Sep 18 '06 #1
4 3207
Louly wrote:
Hi everybody,

I got the code for dimming a menu item from this group after looking
for it for a long time thanks to those who share their experiences
with the others :)

The problem I'm facing is that it dims the wrong menu item!! Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the 3rd
command in the 2nd menu!! It's driving me crazy!

Thanks for your time and help :)

Lou
The numbering starts with zero so (2) is the index of the third item. From
the Help file...

*********************************************
DoCmd.SetMenuItem menuindex[, commandindex][, subcommandindex][, flag]

The SetMenuItem method has the following arguments.

menuindex
An integer, counting from 0, that's the valid index of a menu on the custom
menu bar or global menu bar for the active window, as defined in the menu
bar macro for the custom menu bar or global menu bar.
If you select a menu with this argument and leave the commandindex and
subcommandindex arguments blank (or set them to -1), you can enable or
disable the menu name itself. You can't, however, check or uncheck a menu
name (Microsoft Access ignores the acMenuCheck and acMenuUncheck settings
for the flag argument for menu names).

commandindex
An integer, counting from 0, that's the valid index of a command on the menu
selected by the menuindex argument, as defined in the macro group that
defines the selected menu for the custom menu bar or global menu bar for the
active window.

subcommandindex
An integer, counting from 0, that's the valid index of a subcommand in the
submenu selected by the commandindex argument, as defined in the macro group
that defines the selected submenu for the custom menu bar or global menu bar
for the active window.

flag
One of the following intrinsic constants:
acMenuCheck
acMenuGray
acMenuUncheck
acMenuUngray (default)
If you leave this argument blank, the default constant
(acMenuUngray) is assumed.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Sep 18 '06 #2
Louly wrote:
The problem I'm facing is that it dims the wrong menu item!! Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the 3rd
command in the 2nd menu!! It's driving me crazy!
Hi Lou,

I don't use that method myself. I presume acMenuGray makes the menu
item greyed out and disabled?

If so, try this:

Commandbars("mnuName").Controls(1).controls(2).ena bled = false

The above will diable the SECOND menu item on the second menu of mnuName.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Sep 18 '06 #3
Can anybody help me with this?!! It's still dimming the wrong menu
item! Please help.

Thanks,
Lou

Sep 30 '06 #4
"Louly" <mi*****@gmail.comwrote in
news:11*********************@b28g2000cwb.googlegro ups.com:
Can anybody help me with this?!! It's still dimming the wrong
menu item! Please help.

Thanks,
Lou
Somebody posted your fix already.
>The problem I'm facing is that it dims the wrong menu item!!
Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the
3rd
command in the 2nd menu!! It's driving me crazy!
From the help file

expression.SetMenuItem(MenuIndex, CommandIndex, SubcommandIndex,
Flag)

expression Required. An expression that returns one of the
objects in the Applies To list.

MenuIndex Required Variant. An integer, counting from 0, that's
the valid index of a menu on the custom menu bar or global menu
bar for the active window, as defined in the menu bar macro for
the custom menu bar or global menu bar.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
3
by: Matthew | last post by:
in a page, I have a dropdown menu, and below the menu there is a dropDownList control. when the menuItem is pulled down, the DropDownList control always on top of the menu div, what cause this? I...
0
by: John Smith | last post by:
I still have not gotten this damn thing figured out and I'm asking for help one last time before I give up on it. I have a user control that contains a paged gridview control. The master page...
3
by: belton180 | last post by:
CODE]../* Program function: Simulate the stack using a stack limit of 10. Display a menu for the the following. Create a stack Insert an item in the stack Pop an item from the stack ...
2
by: Afshar | last post by:
Dear nice people around the world! Please help ending this nightmare, I have 2 problem with ASP.NET Menu control First: I have a horizontal menu at top of my page, each item have some sub-items...
1
by: Kayvine | last post by:
Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to...
14
by: jmDesktop | last post by:
I have a food menu. Each area, like beverages, grill, etc. have items under them, Coke, Tea, Coffee would be under beverages for example. I want to add a new drink to beverages. In my database...
4
by: stuckagain | last post by:
Hi, I have a page with a scrollable DIV, and within that DIV, I have a few asp.net menu controls. The idea being, the user mouses over the small icons and is presented with a list of options. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.