Remove default Menus

I

Imran Ghani

Hi! I am buiding an application using MS Access 2007. I'd like to remove all
the default menus which load with the application. How can I just display the
form without any of the default menus. Thanks in advance.
 
D

Dale_Fye via AccessMonster.com

don't know the right term for it, but click on the icon in the upper left
corner of Access when it opens; then click the Access Options button at the
bottom of the pop-up window.

Once the Access Options dialog has loaded, click the Current Database option
and scroll down to the Ribbon and Toolbar Options. From there you can change
the default ribbon, menu, shortcut menu, and can enable or disable the menus,
shortcut menus, and toolbars.

I also include two subroutines in my 2007 applications that allow me to
display the ribbon or navepane programatically. In the DisplayNavPane, you
will need to pick an object that is in your database to replace
"local_parameters".

Public Sub DisplayNavPane(Optional IsVisible As Boolean = True)

Dim strTableName As String

On Error GoTo DisplayNavPaneError

strTableName = "local_Parameters"
DoCmd.SelectObject acTable, strTableName, True

If IsVisible = False Then
DoCmd.RunCommand acCmdWindowHide
End If

Exit Sub

DisplayNavPaneError:

If Err.Number = 2544 Then
'Get the name of the first table in the mSysObjects table
strTableName = DLookup("Name", "mSysObjects", "[Type] = 1 AND [Flags]
= 0")
Resume
Else
DisplayError ("Error encountered in DisplayNavPane subroutine!")
End If

End Sub

Public Sub DisplayRibbon(Optional IsVisible As Boolean = True)

Dim intAction As Integer

If Application.Version <> 12 Then
'do nothing
ElseIf IsVisible Then
DoCmd.ShowToolbar "Ribbon", acToolbarYes
Else
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End If

End Sub

HTH
Dale
 
A

Albert D. Kallal

Imran Ghani said:
Hi! I am buiding an application using MS Access 2007. I'd like to remove
all
the default menus which load with the application. How can I just display
the
form without any of the default menus. Thanks in advance.

You most certainly can, and should hide all of the ms-access interface. The
options to complete hide and keep people out of the ms-access interface can
easily be done using the tools->start-up options. Using those options allows
you to complete hide the ms-access interface (tool bars, database window
etc). Also, using these options means you
do not have to bother setting up security.

Try downloading and running the 3rd example at my following web site that
shows a hidden ms-access interface, and NO CODE is required to do
this....but just some settings in the start-up.

Check out:

http://www.members.shaw.ca/AlbertKallal/msaccess/DownLoad.htm

After you try the application, you can exit, and then re-load the
application, but hold down the shift key to by-pass the start-up options. If
want, you can even disable the shift key by pass. I have a sample mdb file
that will let you "set" the shift key bypass on any application you want.
You can get this at:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
S

Sky

Dale_Fye via AccessMonster.com said:
don't know the right term for it, but click on the icon in the upper left
corner of Access when it opens; then click the Access Options button at
the
bottom of the pop-up window.

Once the Access Options dialog has loaded, click the Current Database
option
and scroll down to the Ribbon and Toolbar Options. From there you can
change
the default ribbon, menu, shortcut menu, and can enable or disable the
menus,
shortcut menus, and toolbars.

I also include two subroutines in my 2007 applications that allow me to
display the ribbon or navepane programatically. In the DisplayNavPane,
you
will need to pick an object that is in your database to replace
"local_parameters".

Public Sub DisplayNavPane(Optional IsVisible As Boolean = True)

Dim strTableName As String

On Error GoTo DisplayNavPaneError

strTableName = "local_Parameters"
DoCmd.SelectObject acTable, strTableName, True

If IsVisible = False Then
DoCmd.RunCommand acCmdWindowHide
End If

Exit Sub

DisplayNavPaneError:

If Err.Number = 2544 Then
'Get the name of the first table in the mSysObjects table
strTableName = DLookup("Name", "mSysObjects", "[Type] = 1 AND
[Flags]
= 0")
Resume
Else
DisplayError ("Error encountered in DisplayNavPane subroutine!")
End If

End Sub

Here is an experiment to test your code.

In the Navigation Pane, set the Category by Object Type (most people do
this). Then collapse the Tables group.

Now open a form so it gets the focus. Then run your code with DisplayNavPane
False.

As I have noted before, in my testing, code like yours hides the FORM, and
it does NOT hide the Navigation Pane. That is because if the Tables group is
collapsed or hidden in the Navigation Pane, the focus is never moved to the
Pane.

To reliably move the focus to the Pane, you can use something like this:

DoCmd.NavigateTo "acNavigationCategoryObjectType"

Note the constant within a string. It is not documented properly in help

- Steve
 
D

Dale_Fye via AccessMonster.com

Thanks, Steve.

Although I generally leave my tables group expanded, I'll add this to my code.


Dale
don't know the right term for it, but click on the icon in the upper left
corner of Access when it opens; then click the Access Options button at
[quoted text clipped - 43 lines]

Here is an experiment to test your code.

In the Navigation Pane, set the Category by Object Type (most people do
this). Then collapse the Tables group.

Now open a form so it gets the focus. Then run your code with DisplayNavPane
False.

As I have noted before, in my testing, code like yours hides the FORM, and
it does NOT hide the Navigation Pane. That is because if the Tables group is
collapsed or hidden in the Navigation Pane, the focus is never moved to the
Pane.

To reliably move the focus to the Pane, you can use something like this:

DoCmd.NavigateTo "acNavigationCategoryObjectType"

Note the constant within a string. It is not documented properly in help

- Steve
 
I

Imran Ghani

Thanks for your fine example and code. I'd appreciate much if you could also
guide me about how to even remove the MS Office Icon and the window appearing
behind. I want to just show my form and nothing else should appear behind.
Can it be done?
 
I

Imran Ghani

Hi Albert
Thanks for your nice examples. I'd looked at the settings of start-up
options of tools. Kindly also guide me how to even remove the blue background
window and the MS office button also, and just let show the form only in the
application.
 
D

Dale_Fye via AccessMonster.com

Yes, you can do it, but you need to have really, really good error handling.
If your code bombs, and the Access window is hidden, you have no way to get
to your code, and will have to use the Windows Task Manager to close your
form.

Check out the code at the following link:
http://www.mvps.org/access/api/api0019.htm

HTH
Dale

Imran said:
Thanks for your fine example and code. I'd appreciate much if you could also
guide me about how to even remove the MS Office Icon and the window appearing
behind. I want to just show my form and nothing else should appear behind.
Can it be done?
[quoted text clipped - 24 lines]
 
A

Albert D. Kallal

Imran Ghani said:
Hi Albert
Thanks for your nice examples. I'd looked at the settings of start-up
options of tools. Kindly also guide me how to even remove the blue
background
window and the MS office button also, and just let show the form only in
the
application.

I don't really recommend you attempt to remove the background. If you used
word, excel, and most other office applications, you see that if you remove
the windows in tab setting, you see a main excel window, with each child
spreadsheet as a window. I think office has worked this way for about 15
years.

I would just recommend that you maximize your forms so they hide the
background.

You can use the api mentioned in the other posters link, but I really think
it is a waste of time and resources to obtain something that next to nothing
in terms of value for your application. Just maximize your forms...and they
always hide the background..

In fact, choose the tabbed interface, and again your users will never see
the background....

I am very much at a loss as to why this is really needed nor even a
significant issue......

at the end of the day, access is not really setup to run without a MDI
interface (do a Google on what is called multiple document interface...this
is what all of office has). However, access 2007 is quite a bit better,
since you can use a tabbed interface, and you never see that background
anyway...

Have you tried using a tabbed interface here?....I think that would be FAR
LESS work then trying to use the api in the other post to hack and hide the
background.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top