Solved

Remove Access Menu Bar and Title Bar

Posted on 2000-03-21
9
1,221 Views
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.
0
Comment
Question by:curtn
9 Comments
 
LVL 1

Accepted Solution

by:
mb1ake earned 100 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
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
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
0
 
LVL 1

Expert Comment

by:spruce22
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!

spruce22
0
 
LVL 7

Expert Comment

by:JimMorgan
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.

Jim
0
 

Expert Comment

by:GOLLEM
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....)

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 9

Expert Comment

by:BrianWren
ID: 2645318
GOLLEM,

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?'

Brian
0
 
LVL 7

Expert Comment

by:JimMorgan
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.

Jim
0
 

Author Comment

by:curtn
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?
0
 

Author Comment

by:curtn
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!  
0
 
LVL 7

Expert Comment

by:JimMorgan
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.

Jim
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now