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