Remove Access Menu Bar and Title Bar

Posted on 2000-03-21
Medium Priority
Last Modified: 2012-06-21
How do you remove the Main Menu Bar from the main Access97 Parent Window.  Also is there a way to to eliminate the Main Access Title Bar or remove the Minimize, Maximize & Close buttons on the Main Parent Access97 Title Bar.
Question by:curtn

Accepted Solution

mb1ake earned 400 total points
ID: 2643224
This code hides the Access window using API calls so BE CAREFUL!  If you do not have a form that is a pop up form with an exit option you will have locked yourself out of that instance of Access.
Use at your own risk.  Create a module with the following code and then in the on open event of your pop up form type "fAccessWindow(Hide)"

Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
Const SW_HIDE = 0
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _     ByVal nCmdShow As Long) As Long
Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean If Procedure = "Hide" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED) End If
If Procedure = "Minimize" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED) End If
If SwitchStatus = True Then
    If IsWindowVisible(hWndAccessApp) = 1 Then
        dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)     Else
        dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)     End If
End If
If StatusCheck = True Then
    If IsWindowVisible(hWndAccessApp) = 0 Then
        fAccessWindow = False
    End If
    If IsWindowVisible(hWndAccessApp) = 1 Then
        fAccessWindow = True
    End If
End If
End Function

Expert Comment

ID: 2643613
I think mb1ake has the answer you're looking for, I just wanted to elaborate.  If you don't want to hide all of access, you can create your own menu bar, assign that menu bar to your form, and make your form the startup form of the database.  But I don't think you can get rid of the Min/Max buttons on the menu bar.  If you do hide all of Access (using the fAccessWindow function in the above post), make sure you have the forms pop up property set to true.  Otherwise the form will be hidden when you hide access.  Also make sure you call application.Quit in the close event of the form. You'll want to make this the startup form of your database.  In case you don't know how, click tools, startup, and select the form name from the Display Form dropdown.  Note that the startup form can be bypassed by holding shift down when you start access, but you can disable that ability by selecting Use Access Special Keys(in acc2000, forget exactly what it's called in 97 but it's in the advanced portion of startup properties).  What a bunch of rambling!


Expert Comment

ID: 2643766
curtn:  Welcome to EE.

You don't have to go through all that code writing and making API calls to do what I think you want to do.  You just want to keep a user under program control.

Spruce22 mentioned the Startup option under the Tools menu.  You have almost all the control that you want regarding how an application will appear from there.  You can provide your own Title, Icon, Custom Menu Bar, Custom Shortcut Menu Bar, and even the Display (startup form).  I prefer not to have a display form and use an AutoExec macro to call a procedure that checks to be sure everything is OK and load the forms.

The most important thing in the Startup option is the ability to customize what portion of Access you leave available to the user (or none).  The options are:

Allow Full Menus
Allow Default Shortcut Menus
Allow Viewing Code After Errors
Allow Built-in Toolbars
Allow Toolbar/Menu Changes
Display Database Window
Display Status Bar
Use Access Special Keys

We only check on Display Status Bar.  Everything else is off.

Regarding turning off the shift key so that the application starts without interuption - turning off Use Access Special Keys is not the answer.  There is code to make this change from a setup DB.  If you feel that you need it, I can give you a copy.

There was quite a bit of discussion about how to turn off the Min, Max, and Close buttons last Fall.  I will have to go back into my archives to find the answer, if you really feel that you want to do it.  I see no reason to do this.  I don't care if the app is minimized or not (I set the opening as Exclusive so the user cannot open two copies at the same time.) and I trap the Close button so that I can do a proper shutdown.

There are a few other customization tricks you can do by clicking the Options item under the Tools menu.  Exclusive is one of those options.

If you elaborate more on exactly what you want to do and why, I can provide you with more details.  BTW, I write commercial Access applications and user interface and security are my hot buttons.


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Expert Comment

ID: 2644336
One simple line of code to put in your startup screen.. be sure to have a database with a button that does the opposite because there's always the possibility of a user pushing reset before you have turned the window back on.

CommandBars.Item(32).Enabled = False

deletes the MenuBar, closing the last form available also closes MS Access

Be sure to set it back to enabled when you close the main form!!!

Another way to hide the access-window is much simpler. Just use a form that has it's properties set as follows:

borderstyle         = None
Min Max Buttons = None
Closebutton        = No
Autoresize          = Yes
Autocenter          = Yes

then make sure the form is big enough to cover the entire screen

This is a safer way, the close button of the pop-up form can be linked to closing Access  

(using Commandbars.Menubar. Item(#) I think....)


Expert Comment

ID: 2645318

It is customary in the Access Topic area to post answers as 'Comments,' instead of proposing them as 'Answers.'  This prevents the question from being locked, encouraging more robust exchanges, and avoids making the person who asked the question reject one answer so that they can accept a different one.  

Would you please convert your 'Answer' to a 'Comment?'


Expert Comment

ID: 2646016
curtn:  I found a couple of previous questions which might give you more information about removing the title bar et all.  I could have repeated the information here but there is a discussion involved which you might want to read, since we really aren't sure why you want to do this.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10232791  will cost you 5 points to read.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=10245367  is free since the poster deleted the question after the comments were posted.

Of course, I'm still waiting for more information before I write a substantial bit of information that you might not need.


Author Comment

ID: 2647555
The answer provided simply said "Text below", with no other explanation.  His answer should have been a comment it seems.  Was he trying to poach points from somebody with the correct answer?

Author Comment

ID: 2647561
Awesome!  I have been looking for this type of solution for a ongoing problem.  I tried it, and it worked flawlessly.  Thanks alot!  

Expert Comment

ID: 2650632
You have to click on the "Text below" to actually see the answer.  For PAQ's the thread is blocked until you pay the few points (10% of the original points for the question) to see the thread and the answer.  I still recommend going back to the first URL reference and reading the thread.  It is very informative about the whole process.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question