By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

Popup/context menus not showing in modal forms

P: n/a
I have created many shortcut/popup (aka context, or right-click) menus for my
application - instead of toolbars or standard drop-down menus.

Within my custom menu, I am using =ShowMainMenu("item") in the On Action
event where ShowMainMenu is a public function in frmMain, and "item" is a
string mapping to a button click event.

(error trapping omitted)

Public Function ShowMainMenu(strItem As String) As Boolean

Dim blnResult As Boolean

Select Case strItem

Case "firstItem"
cmdFirst_Click
Case "secondItem"
cmdSecond_Click
End Select

ShowMainMenu = blnResult

End Function

(each form has a variation on this function)

It appears that my menus work fine in forms that are not modal dialog
windows, but the modal ones seem to block the communication between the menu
and the form. I have a break set on the function, but it never trips.

I have a few forms that are opened modally AND non-modally depending on the
calling form. Modal = no workie.

Is this a known limitation? Is there some sort of setting somwhere or VBA
code I can write to work around this?

Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a

It is entirely possible that you're confusing the issue between dialog
forms, and what are known as model forms in MS access.

Dialog forms do not allow the cursor/focus to use any of the custom or built
in menus at all. The behavior is the same as if in code you displayed a
msgbox command. Now how when using a msgbox command you can not use menus,
or have the focus move to anything other than that actual form (or dialog
box). This includes also the built in menus, or in your case custom menu
bars, they simply cannot be used in any way shape or form when you use a
dialog form. (or the msgbox command...you can even try this from the debug
window, and type in:

msgbox "hello"

now, try and use the menus...you can not untill you hit ok.
It appears that my menus work fine in forms that are not modal dialog
windows
modal disalog form??? Model forms, and dialog forms are VERY VERY much
different animals.
I have a few forms that are opened modally AND non-modally depending on
the
calling form. Modal = no workie.
The above information is likely incorrect, since the openform command has NO
way of setting a form as modal, or non model via the open command. You can
certainly supply the acdialog parameter, and the form will open as dialog,
but that is NOT the forms model setting, and is very much a differnt setting
alltogher.

If you want to open a form as model in code, then you have to go:

dim strF as string

strF = "name of my form goes here"

docmd.OpenForm strF
forms(strF).modal = true
>
Is this a known limitation? Is there some sort of setting somwhere or VBA
code I can write to work around this?
Keep in mind the difference between modal, and dialog forms, I explain the
difference here:

http://www.members.shaw.ca/AlbertKal...log/Index.html

are you use you need dialog forms, or will a modal form suffice?

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com

Jun 27 '08 #2

P: n/a
"Albert D. Kallal" <Pl*******************@msn.comwrote in
news:6jQRj.100707$rd2.81244@pd7urf3no:
>
It is entirely possible that you're confusing the issue between dialog
forms, and what are known as model forms in MS access.
Yes, you nailed it. That's exactly what happened. I've been opening forms
with acDialog, thinking that gives me a modal form. I may have never
discovered it if I hadn't tried to implement custom menus. Doh!

If you want to open a form as model in code, then you have to go:

dim strF as string

strF = "name of my form goes here"

docmd.OpenForm strF
forms(strF).modal = true
So the second line is executed before the form opens?

It appears that I can do Me.Modal = True in my Form_Open event. Is that
equivalent?
are you use you need dialog forms, or will a modal form suffice?
Modal forms are exactly what I need, and I can now go and rewrite all my form
opening code to do away with acDialog (except in the few cases I might need
it). Thanks for the quick education!
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.