473,320 Members | 1,839 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,320 software developers and data experts.

Prevent Custom Menu From Appearing

Hey group!

I have a toolbar with a "DEVELOPER" menu. I have it so that it when the
menu title is clicked, a pop-up form will appear if the user has not
yet verified that he or she has developer privileges (this menu only
appears when the user is set up as a developer, but i'm a bit paranoid
on these matters i guess).

My problem is that when the menu title is clicked, the form appears but
so does the menu, and the menu has the focus, so the user has to
manually click the window. A minor inconvenience, but one I'd like to
be rid of.

I've temporarily patched this with a sendkeys (i know, i know), as when
a button is pressed, the menu closes and the form takes focus.
Obviously, I want to be rid of the sendkeys.

Any ideas? If not, I could always just scrap the validation and rely on
the visible property when the user record says its a developer.

Thanks for any tips of tricks you can pass on.

Nov 13 '05 #1
4 1907
je************@gmail.com wrote:
I have a toolbar with a "DEVELOPER" menu. I have it so that it when the
menu title is clicked, a pop-up form will appear if the user has not
yet verified that he or she has developer privileges (this menu only
appears when the user is set up as a developer, but i'm a bit paranoid
on these matters i guess).

My problem is that when the menu title is clicked, the form appears but
so does the menu, and the menu has the focus, so the user has to
manually click the window. A minor inconvenience, but one I'd like to
be rid of.


I can't figure out what you're talking about here - I get the impression
that the first toolbar you mention in para 1, above, that a menu control
called "DEVELOPER" is supposed to be clicked, making a pop up form appear.

But then you talk about another "a menu appears" when the pop up form
appears. What menu? The one you were first talking about? Also, I'm
not sure what you mean when you say "the user has to manually click the
window". what window? The pop up?

The above confusion aside, here are a couple of _separate_ options:

1) Make the pop up form modal as well. That way the menu can't be
clicked and the form will have the focus; or

2) Presumeably the "DEVELOPER" menu item has a function associated with
it that checks to see if developer privileges have been confirmed, and,
if not, performs a docmd.openform. You could use the acDialog argument
for the window mode argument of this docmd method; or

3) In the same function as described in 2, above, after the form is
opened, use the setfocus method to put the focus on the form or a
control on the form.

If this doesn't help, you'll need to clarify what I describe in para 2
of my response, above.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #2
Sorry for the confusion.

In the toolbar, there is a menu. For reference, we'll compare it to the
file menu.
When you click the word "File" it drops down a menu with New, Open,
etc.
Similarly, in my db, when you click "Developer", it drops down menu
with VB Editor, etc.
The menu has an OnAction when you click "Developer" that pops up a
modal pop-up form "frmDeveloper" that does authentication.
However, when the menu (the word "Developer") is clicked, both the
frmDeveloper and the menu appear (menu being the VB Editor, Show DB
Window, etc.), but the form doesn't take the focus. When you type when
the form comes up, the first keypress just closes the menu and gives
focus to the pop-up, so if i click "Developer" and key in "Password",
the form would receive "assword", hence the original sendkeys.
I tried the acDialog idea, but the form still doesn't take focus.
Keypresses go to anything but the form.

I really hope this clarified things, though I probably only made things
worse.
Thanks for trying anyway.

Nov 13 '05 #3
je************@gmail.com wrote:
Sorry for the confusion.

In the toolbar, there is a menu. For reference, we'll compare it to the
file menu.
When you click the word "File" it drops down a menu with New, Open,
etc.
Similarly, in my db, when you click "Developer", it drops down menu
with VB Editor, etc.
The menu has an OnAction when you click "Developer" that pops up a
modal pop-up form "frmDeveloper" that does authentication.
However, when the menu (the word "Developer") is clicked, both the
frmDeveloper and the menu appear (menu being the VB Editor, Show DB
Window, etc.), but the form doesn't take the focus. When you type when
the form comes up, the first keypress just closes the menu and gives
focus to the pop-up, so if i click "Developer" and key in "Password",
the form would receive "assword", hence the original sendkeys.
I tried the acDialog idea, but the form still doesn't take focus.
Keypresses go to anything but the form.

I really hope this clarified things, though I probably only made things
worse.
Thanks for trying anyway.


OK, I think I see. The Developer menu item is a menu of it's own *and*
there is an action associated with it.

I don't think it's very intuitive to have a function associated with a
drop down menu, myself.

What about doing this.

You must check to see whether or not the user has been authenticated.
Do this in a public function in a standard module with a boolean result.
If the person is authenticated, the result will be true, otherwise,
false. Let's call this function fAuthenticate() for argument's sake.

Now, in each of the function associated with the actions on all the menu
items under Developer, include the following (air code):

Function fShowDbWindow()

if fAuthenticate() = False then

if msgbox("If you wish to proceed with opening the DB window, You
must first be assimilated!" & vbcrlf & vbcrlf & "Continue?", vbQuestion
+ vbOKCAncel, "Authentication Required!") = vbOK then

docmd.openForm "frmDeveloper"

end if

else 'user has already been authenticated

'do stuff

end if

End function

I think you'll find this to be better from a user convenience point of
view. I had one developer try to do an application for my department
once and she had all kinds of actions associated with drop down menus.
It was irritating as all hell. Think to yourself if you've ever
encountered this sort of thing before.

Another option would be to have the menu items disabled or invisible.
say your menu bar is called mnuMain. Have the first item on the
Developer menu be "Autehnticate". The on open event of your splash or
opening form could have a call to a public function that does this:

if fAuthenticate() = False then

commandbars("mnuMain").controls("DEVELOPER")._
controls("dbWindowItem").enabled = false

commandbars("mnuMain").controls("DEVELOPER")._
controls("VBA Menu").enabled = false

'etc

else

commandbars("mnuMain").controls("DEVELOPER")._
controls("dbWindowItem").enabled = true

commandbars("mnuMain").controls("DEVELOPER")._
controls("VBA Menu").enabled = true

'etc

end if

The authenticate menu item opens frmDeveloper and after a successful
authentication on the frmDeveloper form, call the function containing
the above if statement.

So that's my advice. Sorry it's not a fix, but I've given you two
better, IMHO, alternatives.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4
The funny thing is, I already have it set up so that only those users
with developers access can even see the developer menu. I just had a
residual form from when i was gonna do it another way and i decided why
not keep it anyway. I guess i'll just toss it if its gonna be a pain.
Shame tho, I rather liked the design of that form. lol

thanks

Nov 13 '05 #5

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

Similar topics

2
by: Sean Mullaly | last post by:
I have a custom Access menu with sub-menus and sub-sub-menus. (220 items). Right now I have created 220 Functions and attached each individual Function to the specific OnAction property. The...
0
by: Fatz | last post by:
I have a table that is an autonumber field. This table appears as a subform in another form. I want the ID# to show in the subform...but I don't want the (Autonumber) to show at the bottom of the...
7
by: Ian Hinson | last post by:
I have an Access app that has been distributed with run-time installation to many different customers over many years. It is developed in Access 2000. The custom menu bar has had no problems in...
1
by: Vadim | last post by:
Our program is planing to often download generated reports in MS Word and it's hihg unlikely to bother uthers to push buttons in appearing download dialog for our corporate site. How to prevent...
4
by: jon morgan | last post by:
Hello, In an MDI application how can I prevent the CLR automatically merging a child windows' menu with that of the parent MDI form ? Thanks for any help Jon
16
by: MLH | last post by:
If I give someone a runtime app, they can open the database window by pressing the F-11 key. How to prevent???
27
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same...
5
by: lorirobn | last post by:
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...
2
by: AjitGoel | last post by:
Hi; I need to create a custom textbox control which will not allow a user to paste text from the clipboard. The user has to always type the text into the textbox. I tried searching on the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.