Menus on forms

P

Paradigm

Does anyone know of an OCX or similar that I can use to put a proper menu on
an Access form. My application has dozens of forms and each has menu options
specific to it. I find that having the main access window open confuses my
clients and I usually hide it. Each form is a pop up form and I often hide
other forms so that the user only has one form open at a time. I would like
to put a menu on the form. I normally use command buttons but sometime I run
out of space for the number of options I need.
Alec
 
P

Paradigm

This does not work if the main access window is hidden. If I display the
main window the popup menu appears but I want to run with the main window
hidden. If I was displaying the main window then I could use the normal
menus.
Alec

Rick Brandt said:
Paradigm said:
Does anyone know of an OCX or similar that I can use to put a proper
menu on an Access form. My application has dozens of forms and each
has menu options specific to it. I find that having the main access
window open confuses my clients and I usually hide it. Each form is a
pop up form and I often hide other forms so that the user only has
one form open at a time. I would like to put a menu on the form. I
normally use command buttons but sometime I run out of space for the
number of options I need.
Alec

When I want this I put a single button [ Menu ] that when pressed displays a
shortcut menu.
 
P

Paradigm

My application has more than 80 different mde files as a front end (all
managed by a control panel) each of these may have upto 20-30 different
forms and hundreds of reports in them and all based on more than SQL 250
tables.
I think the main Access window with its grey background confuses my users,
e.g. maximize a form and it only maximises it in the window and then they
have to maximise the window as well. This is not how normal, standard
windows apps usually work. I control which form is visible and all forms are
popups with some being modal. When I display a report preview I hide all
forms so that only the report is visible and when it is closed the
appropriate form is then redisplayed.

Each form uses a number of command buttons appropriate to the form. If I was
using menus in the main window I would require dozens of them in each mde
file and have to keep switching the menus depending on what I want the user
to be able to do at any point in time.

The only reason I need a menu on a form is that I sometimes run out of space
on the form for all the options.

Alec
 
R

Rick Brandt

Paradigm said:
My application has more than 80 different mde files as a front end
(all managed by a control panel) each of these may have upto 20-30
different forms and hundreds of reports in them and all based on more
than SQL 250 tables.
I think the main Access window with its grey background confuses my
users, e.g. maximize a form and it only maximises it in the window
and then they have to maximise the window as well. This is not how
normal, standard windows apps usually work. I control which form is
visible and all forms are popups with some being modal. When I
display a report preview I hide all forms so that only the report is
visible and when it is closed the appropriate form is then
redisplayed.

Each form uses a number of command buttons appropriate to the form.
If I was using menus in the main window I would require dozens of
them in each mde file and have to keep switching the menus depending
on what I want the user to be able to do at any point in time.

The only reason I need a menu on a form is that I sometimes run out
of space on the form for all the options.

I just tried the Shortcut menu method previously described in my one app
that hides the Access window and the menu still worked fine for me. I use
the command...

CommandBars![MenuName].ShowPopup
 
P

Paradigm

I use the following function with the SW_SHOWMINIMIXED parameter to hide the
main access window.

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function

when I then use
CommandBars![MenuName].ShowPopup
I get
Method Showpopup of Object 'CommandBar' failed.
Alec

Rick Brandt said:
Paradigm said:
My application has more than 80 different mde files as a front end
(all managed by a control panel) each of these may have upto 20-30
different forms and hundreds of reports in them and all based on more
than SQL 250 tables.
I think the main Access window with its grey background confuses my
users, e.g. maximize a form and it only maximises it in the window
and then they have to maximise the window as well. This is not how
normal, standard windows apps usually work. I control which form is
visible and all forms are popups with some being modal. When I
display a report preview I hide all forms so that only the report is
visible and when it is closed the appropriate form is then
redisplayed.

Each form uses a number of command buttons appropriate to the form.
If I was using menus in the main window I would require dozens of
them in each mde file and have to keep switching the menus depending
on what I want the user to be able to do at any point in time.

The only reason I need a menu on a form is that I sometimes run out
of space on the form for all the options.

I just tried the Shortcut menu method previously described in my one app
that hides the Access window and the menu still worked fine for me. I use
the command...

CommandBars![MenuName].ShowPopup
 
R

Rick Brandt

Paradigm said:
I use the following function with the SW_SHOWMINIMIXED parameter to
hide the main access window.

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function

when I then use
CommandBars![MenuName].ShowPopup
I get
Method Showpopup of Object 'CommandBar' failed.
Alec

I was using Access 97 in my test, but I am using that exact code to hide the
Access window and for my test I put the command bar code in the double-click
event of the form. I opened the app and the Access window was hidden as
expected. When I double-clicked the form background the shortcut menu was
displayed.
 
P

Paradigm

I am using Access 2K. I put the code on a command button and the menu does
not open. I also tried the code

Set objPopup = CommandBars("myshortcut")
objPopup.ShowPopup

and I do not get any error but the menu dos not open.
Alec


Rick Brandt said:
Paradigm said:
I use the following function with the SW_SHOWMINIMIXED parameter to
hide the main access window.

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function

when I then use
CommandBars![MenuName].ShowPopup
I get
Method Showpopup of Object 'CommandBar' failed.
Alec

I was using Access 97 in my test, but I am using that exact code to hide the
Access window and for my test I put the command bar code in the double-click
event of the form. I opened the app and the Access window was hidden as
expected. When I double-clicked the form background the shortcut menu was
displayed.
 
E

eyal

Rick Brandt said:
I've only got A97 here at home, but I can try it with a newer version on Monday
at work. Doesn't seem to me to be somethng that would be version dependent, but
one never knows with MS.
 
R

Rick Brandt

Rick said:
I've only got A97 here at home, but I can try it with a newer version
on Monday at work. Doesn't seem to me to be somethng that would be
version dependent, but one never knows with MS.

I just tried the same test with Access 2000, 2002, and 2003. The shortcut
menu was displayed just fine in all three versions.
 
P

Paradigm

Thank you for your help in this. Perhaps you could show me the code you use
exactly to display the menu. I am finding that if the main window is
minimized it does not display and if I simply remove the one line of code
that minimizes the main window then the menu does display.
Alec
 
R

Rick Brandt

Paradigm said:
Thank you for your help in this. Perhaps you could show me the code
you use exactly to display the menu. I am finding that if the main
window is minimized it does not display and if I simply remove the
one line of code that minimizes the main window then the menu does
display.
Alec

I created a shortcut menu with a single item on it and named the menu
"Test". My line of code that displays it is...

CommandBars![Test].ShowPopup

Are you sure you are setting the property of the menu to "popup" and are you
attempting this with a custom menu or a built in one? I don't know if the
latter makes any difference, but all of my testing has been with a custom
one.
 
P

Paradigm

I have one popup form with the main access window minimixed. I have a popup
menu named scuttimesheet
I have a button on the form with an on clkick event function
CommandBars![scuttimesheet].ShowPopup

I get the error
Method 'Showpopup' of object "'commandbar' failed.

Alec

Rick Brandt said:
Paradigm said:
Thank you for your help in this. Perhaps you could show me the code
you use exactly to display the menu. I am finding that if the main
window is minimized it does not display and if I simply remove the
one line of code that minimizes the main window then the menu does
display.
Alec

I created a shortcut menu with a single item on it and named the menu
"Test". My line of code that displays it is...

CommandBars![Test].ShowPopup

Are you sure you are setting the property of the menu to "popup" and are you
attempting this with a custom menu or a built in one? I don't know if the
latter makes any difference, but all of my testing has been with a custom
one.
 
R

Rick Brandt

Paradigm said:
I have one popup form with the main access window minimixed. I have a
popup menu named scuttimesheet
I have a button on the form with an on clkick event function
CommandBars![scuttimesheet].ShowPopup

I get the error
Method 'Showpopup' of object "'commandbar' failed.

Which of those was typed and which was copied and pasted? The code has
CommandBars and the error has CommandBar (missing an 's').

Otherwaise I'm stumped.. I use that line of code extensively in all versions
of Access on machines with all versions of Office and have never had a
problem with it.
 
P

Paradigm

I have tried this beforein the past and I gave up assuming that it would not
work with popup forms when the main window is hidden. As far as I can tell
that is still the case.
Changing one line of code (the one that minimises the main widnow) will let
the popup menu appear. So I assume my code must be correct, no errors.

Alec

Rick Brandt said:
Paradigm said:
I have one popup form with the main access window minimixed. I have a
popup menu named scuttimesheet
I have a button on the form with an on clkick event function
CommandBars![scuttimesheet].ShowPopup

I get the error
Method 'Showpopup' of object "'commandbar' failed.

Which of those was typed and which was copied and pasted? The code has
CommandBars and the error has CommandBar (missing an 's').

Otherwaise I'm stumped.. I use that line of code extensively in all versions
of Access on machines with all versions of Office and have never had a
problem with it.
 
P

Paradigm

Rick
Would it be possible for you to send me a very simple example where you hide
the main window and have a popup menu appearing.
I can then check it to see if it is my computer or Access installation that
maybe the problem.
alec at alecjames dot com
Thanks
alex

Rick Brandt said:
Paradigm said:
I have one popup form with the main access window minimixed. I have a
popup menu named scuttimesheet
I have a button on the form with an on clkick event function
CommandBars![scuttimesheet].ShowPopup

I get the error
Method 'Showpopup' of object "'commandbar' failed.

Which of those was typed and which was copied and pasted? The code has
CommandBars and the error has CommandBar (missing an 's').

Otherwaise I'm stumped.. I use that line of code extensively in all versions
of Access on machines with all versions of Office and have never had a
problem with it.
 
R

Rick Brandt

Paradigm said:
Rick
Would it be possible for you to send me a very simple example where
you hide the main window and have a popup menu appearing.
I can then check it to see if it is my computer or Access
installation that maybe the problem.
alec at alecjames dot com
Thanks
alex

On its way.
 
Top