Hide ribbon problem (1 Viewer)

DJBummy

Registered User.
Local time
Today, 01:01
Joined
Jun 22, 2001
Messages
90
I believe i found this procedure on this site somewhere.

Option Compare Database
Public bolpress As Boolean
Private Sub cmdHideRibbon_Click()

Dim strform As String
strform = "frmStartUp"
Select Case bolpress
Case False
DoCmd.SelectObject acForm, strform, True
DoCmd.ShowToolbar "Ribbon", acToolbarYes
bolpress = True
Case True
DoCmd.SelectObject acForm, strform, True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
bolpress = False
Case Else
bolpress = True
End Select
End Sub

Whenever I start database by holding the shift key and open the form it works like fine. Hides ribbon, hides the windows button. Only thing visible is the minimize, restore and close button. I think I can take care of that with a function.
My problem arises when I start the database by double clicking and the procedure does not react the same way: Hides navigation pane but not the ribbon or the windows button. Am I missing something here.

Thank you
 

NigelShaw

Registered User.
Local time
Today, 01:01
Joined
Jan 11, 2008
Messages
1,573
Seek my friend, and ye shall find... There is a great search facility in this forum. It's easy to find. It's called 'Search'!

http://www.access-programmers.co.uk/forums/showthread.php?t=206281

I only posted this last week! To use, either break the code up or set BolPress to True when your form loads. As long as nothing else sets the bolPress, your ribbon and nav pane will remain hidden.

Cheers

Nigel
 
Last edited:

NigelShaw

Registered User.
Local time
Today, 01:01
Joined
Jan 11, 2008
Messages
1,573
I believe i found this procedure on this site somewhere.

Option Compare Database
Public bolpress As Boolean
Private Sub cmdHideRibbon_Click()

Dim strform As String
strform = "frmStartUp"
Select Case bolpress
Case False
DoCmd.SelectObject acForm, strform, True
DoCmd.ShowToolbar "Ribbon", acToolbarYes
bolpress = True
Case True
DoCmd.SelectObject acForm, strform, True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
bolpress = False
Case Else
bolpress = True
End Select
End Sub

Whenever I start database by holding the shift key and open the form it works like fine. Hides ribbon, hides the windows button. Only thing visible is the minimize, restore and close button. I think I can take care of that with a function.
My problem arises when I start the database by double clicking and the procedure does not react the same way: Hides navigation pane but not the ribbon or the windows button. Am I missing something here.

Thank you

Hi

Ok so I didn't see that you had already found my code :eek:

It's made for a button on/off so the variable bolPress needs to be set. You could either run the routine on the form load or in an AutoExec. You would need to add at the top under the Dims, bolPress = True. Everything should then be hidden. If you have any problems, I'll post a demo.

Cheers

Nigel
 

NigelShaw

Registered User.
Local time
Today, 01:01
Joined
Jan 11, 2008
Messages
1,573
This should be easier

Code:
Public Function bolPress( As Boolean )
    
    Dim strform As String
    strform = "frmStartUp"
    Select Case bolpress
    Case False
        DoCmd.SelectObject acForm, strform, True
        DoCmd.ShowToolbar "Ribbon", acToolbarYes
  
    Case True
        DoCmd.SelectObject acForm, strform, True
        DoCmd.RunCommand acCmdWindowHide
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
 
    Case Else
 
    End Select
End Function

To turn everything off, call

Code:
bolPress( True )

To turn everything on, call
Code:
bolPress( False )

Cheers
 

DJBummy

Registered User.
Local time
Today, 01:01
Joined
Jun 22, 2001
Messages
90
Nigel

Thank you for your response. Something I failed to mention originally. The database was a 2003 converted to 2007 db. For some reason I couldn't get the code to work in the converted db. So I created a new db in 2007 and inserted the code. Worked just fine. Looks like I have some work ahead of me. Just starting to get used to 2007. Not a big fan of it. Now I am told we are upgrading to 2010. Hopefully it is not too different.

by the way. I seldom post a problem. Only as a last resort and i have exhausted options. As you can see from my join date (2001) I do not abuse the privilege.

Thanks again.
 

ewc

Registered User.
Local time
Yesterday, 17:01
Joined
Oct 18, 2008
Messages
11
Access 2010
Tips I learned with the help of others.

Some excellent websites to manage the ribbon:
accessribbon.de/en/?Access_-_Ribbons
allenbrowne.com/tips.html

Also, the Access Web and Dev Ashish provide great API support that was written for prior versions, but is still very usable and relevant.
mvps.org/access/

Hide the navigation bar if you do not want users to access tables or other database objects.

Hide the ribbon if users should not have access to tables or database objects. See the above website to replace you custom ribbon. You may only want to give users some of the tools (printing, query design). Many thanks to Avenius Gunter and Allen Browne for great work in keeping their sites up.

HOW TO
· Hide the navigation bar:
(Add once at start up and add this after every attach / link to external tables)
' hide the navigvation bar
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide

· Hide the entire ribbon:
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo

· Prevent right mouse access to navigation if user enters “design” mode or control/break when a message box appears:
Open FILE, Options
Locate Current Database
Uncheck Use Access Special Keys
Uncheck Display Navigation Pane


· Prevent users from opening the navigation bar (trap for F11):
(Place code in every form that users can access)
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 122 Then KeyCode = 0 'trap for the F11 key
End Sub

· If Ask Questions is displayed (upper right of database) and not relevant to your database, disable it:
Application.CommandBars.DisableAskAQuestionDropdown = True

· Who had signed into the database today?
This reads the locking database file for the machine name of each user. If maintenance is required and someone has the file open, you can’t compress/repair it.
(Also works on .ldb files - just edit the file extension .laccdb to .ldb)
Function GetUsers()
On Error GoTo err_Users
Dim tmp, tmp2, HoldUsers As String
Dim i As Integer

Open \\ServerDataPath\MyDataBackEnd.laccdb" For Input As #1
Do Until EOF(1)
tmp = Input(31, #1)
tmp2 = Input(31, #1)
i = i + 1
HoldUsers = HoldUsers & i & ") " & tmp & vbCr
Loop

exit_Users:
Close #1
MsgBox "Users logged in:" & vbCr & HoldUsers, , "Logged In"

Exit Function

err_Users:
Resume exit_Users
End Function
 

Users who are viewing this thread

Top Bottom