ACC2002: Custom MenuBar does not load with Form

  • Thread starter Thread starter Tony_VBACoder
  • Start date Start date
T

Tony_VBACoder

Can anyone tell me why the acDialog argument when used to
Open a Form, causes a Custom MenuBar/ToolBar to not load
with the Form that is opened? I need to have my Form2 be
Dialog while it is opened, so the user has to do something
with this form and then close it, which will return them
back to my Form1. If I open Form2 by itself, the Custom
MenuBar/ToolBar loads fine.

My situation is below:

I have 2 Forms who each have there own custom MenuBar and
ToolBar. The code I am using in my "btnOpenForm" button
on Form1 to open Form2 with some criteria, is below:

Private Sub btnOpenForm_Click()

' Minimize the Form
DoCmd.Minimize
' Open the 2nd Form and pass it a Where clause
DoCmd.OpenForm "Form1", , , "[MyID] = " & iID, acFormEdit,
acDialog

End Sub

However, if I change the .OpenForm code to remove the
acDialog argument, the form's MenuBar and ToolBar are
loaded:
DoCmd.OpenForm "Form1", , , "[MyID] = " & iID, acFormEdit
 
First, you are aware that a model form, and a acDialog form a completely
different..right?

Next, a acDialog form is just like the msgbox command...when you execute a
acDialog form, then NONE the menu bars can be used. So, likely..it is not a
big deal that some menu bar shows...or does not show..fact is...both a
msgBox command, and opening a form in acDialog are the same thing..and that
means NOTHING ELSE can get the focus...and that includes menu bars....

So, my suggestion would be to dump the use of the acDialog if you are going
to use ANY form that needs a custom menu bar. You can NOT use or even
"click" on a menu when you use the msgbox command, or use a form via
acDialog (they both are the same thing).

Try running the following,..and see if you can use the menu bar:

msgbox "hello"

Now, while that msgbox is on the screen..try using any menu bar..custom..or
even built in ones.....

Only when you close the msgbox..(or your acdialog Form) can you then use the
menu bars...

So, the solution here is to use a model form.....
 
Albert,

Thank you for the reply and the great explanation on
acDialog vs Modal. It completely makes sense. When I
changed my Form2's "Modal" property to "Yes" and removed
the acDialog argument from my "DoCmd.OpenForm" code, the
custom Menu/Toolbar's loaded fine.
 
Back
Top