Hide Ribbon 2007 Solution

DJBummy

Registered User.
Local time
Today, 11:47
Joined
Jun 22, 2001
Messages
90
Thanks to Nigel for direction on this

For those of you like me who like to:
Hide the minimize,restore and close buttons
Show a particular ribbon for reports
Create splash screens
This is what worked for me:

First download this ribbon (FREE). Very user friendly

http://ribboncustomizer.clatonh.com/Main.aspx

Somewhat limited but it got me to where I needed to be.
The software creates a ribbon called MyRibbon. Part of the limitation I guess.
You can rename it from the USysRibbon table if you wish. By the way I had to delete the table first from the database. Don’t know why but I got an error when creating the ribbon. So if you have any ribbons already created you should back up the original USysRibbon table.

From the current database access options screen:

Select Overlapping Windows: Allows resizing of splash screens from design view to suit your needs.

Uncheck Allow Default Shortcut Menus: Keeps user from right clicking on forms to close or whatever.

Uncheck Display Navigation Pane

Set Ribbon Name to YourRibbonName

The software creates the XML below. I only use Print and Close for my reports. Here it is none the less.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs> <tab idMso="TabHomeAccess" visible="false"/>
<tab id="dbCustomTab" label="BaumHausGolf" visible="true">
<group id="Print" label="Print">
<control idMso="PrintDialogAccess" label="Print Report" enabled="true" size ="large"/>
</group>
<group id="Exit" label="Exit">
<control idMso="PrintPreviewClose" label="Close Report" enabled="true" size ="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

Put function below in a module: Hides the buttons in the upper right corner. I can’t remember where I got this. On here I think. My apologies to whoever posted it.
“I do this because some of my users cannot distinguish the minimize button from the close button. Go figure!
Code:
Function Buttons(Show As Boolean) As Long
Dim hwnd As Long
Dim nIndex As Long
Dim dwNewLong As Long
Dim dwLong As Long
 
hwnd = hWndAccessApp
 
nIndex = GWL_STYLE
Const wFlags = SWP_NOSIZE + SWP_NOZORDER + SWP_FRAMECHANGED + SWP_NOMOVE
Const FLAGS_COMBI = WS_MINIMIZEBOX Or WS_MAXIMIZEBOX Or WS_SYSMENU
dwLong = GetWindowLong(hwnd, nIndex)
 
If Show Then
   dwNewLong = (dwLong Or FLAGS_COMBI)
Else
   dwNewLong = (dwLong And Not FLAGS_COMBI)
End If
 
Call SetWindowLong(hwnd, nIndex, dwNewLong)
 
Call SetWindowPos(hwnd, 0&, 0&, 0&, 0&, 0&, wFlags)
 
End Function
Call the function form a startup form onload event
Call Buttons (False)
“Remember to set to true whenever exiting db.”
Add this to onload event:
DoCmd.ShowToolbar “Ribbon” , acToolbarNo

Hides all of the buttons and ribbons so that only forms and reports are shown.

From your reports property sheet:
Set Close Button = Yes
Ribbon Name = YourRibbonName

On the Open and Close events:

Open: DoCmd.ShowToolbar “Ribbon” , acToolbarYes
This shows only your ribbon for the report, except the Access button in upper left. Couldn’t figure out how to get around this.

Close: Docmd.ShowToolbar “Ribbon” , acToolbarNo
Re-Hides Ribbon

Lastly whenever I first went from 2003 to 2007 I used the covert button. For some reason I was having a lot of trouble with the ribbons after doing this. So I created a new blank 2007 database and imported my tables, forms, queries, reports and modules from the 2003 db. Roundabout way I know but it worked for me. By importing you can select all of your db objects at once instead of one at a time with export. Much faster than exporting from 2003! If you want any custom toolbars from 2003 db select the Menus and Toolbars from the import objects options screen. Although will only go into the 2007 Addins tab.

Hope this helps someone. Any suggestions are welcome.
D.J.
 
Last edited by a moderator:
Hi

An awfully long winded way to get what you want. Access isn't about essays lol :p

There is a much simpler way. Remember, if you think to yourself " there must be an easier way " then there probably is.....

You can turn off the top right buttons on the form properties.

Nigel
 
And DJBummy - please use code tags when posting code (especially longer code):

codetag001.png
 
Thank you for your advice

Nigel I am turning off the buttons on the main access screen not the form.
If there is a better way Im all ears.

Sorry Bob
I will comply in the future
 

Users who are viewing this thread

Back
Top Bottom