Modules to Hide and Show Ribbon & Backup database BackEnd

hfsitumo2001

Member
Local time
Today, 06:15
Joined
Jan 17, 2021
Messages
386
On my attached loginForm, I have an AdminForm on which I put:
  1. Hide Ribbon & Navigation
  2. Show Ribbon & Navigation
  3. Backup database-backend, if possible with front end.
Can any one give me the VBA for those 3 buttons.

Thank you
 

Attachments

Thank you DBGuy, I will study it.
To hide the Ribbon.
Code:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

To show the Ribbon.
Code:
DoCmd.ShowToolbar "Ribbon", acToolbarYes
 
Last edited:
good day...
try codes below, I used this often times

Show codes
forRibbon…
DoCmd.ShowToolbar "Ribbon", acToolbarYes
forNavPane…
Application.SetOption "Show Status Bar", True


Hide codes
forRibbon…
DoCmd.ShowToolbar "Ribbon", acToolbarNo
forNavPane…
Application.SetOption "Show Status Bar", False
DoCmd.NavigateTo "acnavigationcategoryobjecttype"
DoCmd.RunCommand acCmdWindowHide
 
vhung... I tried this for navigation to show, but it did not work. Something wrong I made?
Application.SetOption "Show Status Bar", True
DoCmd.NavigateTo "acnavigationcategoryobjecttype"
DoCmd.RunCommand acCmdWindowYes
To hide the Ribbon.
Code:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

To show the Ribbon.
Code:
DoCmd.ShowToolbar "Ribbon", acToolbarYes
DBGuy, How can we show again Navigation Pane. Hiding is ok, but when I use the vhung's code suggestion, it won't work
 
DBGuy, How can we show again Navigation Pane. Hiding is ok, but when I use the vhung's code suggestion, it won't work
To show NavPane again, try:
Code:
DoCmd.SelectObject acTable, "TableName", True
 
You shouldn't be relying on the user to make backups. Backups should be scheduled regularly either by your IT staff as they back up the server or by using a tool such as the one found at www.fmsinc.com
 
vhung... I tried this for navigation to show, but it did not work. Something wrong I made?
Application.SetOption "Show Status Bar", True
DoCmd.NavigateTo "acnavigationcategoryobjecttype"
DoCmd.RunCommand acCmdWindowYes

DBGuy, How can we show again Navigation Pane. Hiding is ok, but when I use the vhung's code suggestion, it won't work
you rumble it;

use this syntax for hide of navigation pane not for show

Application.SetOption "Show Status Bar", False
DoCmd.NavigateTo "acnavigationcategoryobjecttype"
DoCmd.RunCommand acCmdWindowHide

then on open
forNavPane…
Application.SetOption "Show Status Bar", True
 
you rumble it;

use this syntax for hide of navigation pane not for show

Application.SetOption "Show Status Bar", False
DoCmd.NavigateTo "acnavigationcategoryobjecttype"
DoCmd.RunCommand acCmdWindowHide

then on open
forNavPane…
Application.SetOption "Show Status Bar", True
vhung, I already tried to make your code and I clicked the button show navigation pane. It did not work. I do not mean the navigation of the record at the bottom of the form... On loginform please use Batman_Admin and password "b"
hideorshownavigationpane.png
 

Attachments

use this code to open navigation pane

DoCmd.SelectObject acTable, , True
If Not (objPane Is Nothing) Then
objPane.IsCollapsed = False
End If

codes to close...

DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
Application.SetOption "Show Status Bar", False
 
use this code to open ribbon

DoCmd.ShowToolbar "Ribbon", acToolbarYes
Application.SetOption "Show Status Bar", True


codes to close...

DoCmd.ShowToolbar "Ribbon", acToolbarNo
 
Last edited:
use this code to open navigation pane

DoCmd.SelectObject acTable, , True
If Not (objPane Is Nothing) Then
objPane.IsCollapsed = False
End If

codes to close...

DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
Application.SetOption "Show Status Bar", False
vhung, I use this on click even of the show navigation pane button, but it hanged as follows:
dubug says run time error 424

runtimeerrror424.jpg

Hanged on showbutton.jpg
 
Good day...

If run time errror 424 "object required" prompted.

Answer: The problem isn't your code, it's that the Visual Basic editor does not recognize your form. In fact, the Visual Basic editor will not recognize your form until you've invoked the Code Builder (for your form or any object on your form) at least once.

Please see this link:
 
1- For Hide and Show Navigation Use This Code
Code:
Sub DisplayHideNavPane(Optional Visible As Boolean = True)
    DoCmd.SelectObject acForm, , True
    If Visible = False Then DoCmd.RunCommand acCmdWindowHide
End Sub
2- This code is used to copy the database, but you need a certain mechanism to take the backup copy of the database automatically at specific intervals
Code:
 FileCopy "Source Full Name", "Destination Full Name"
 
1- For Hide and Show Navigation Use This Code
Code:
Sub DisplayHideNavPane(Optional Visible As Boolean = True)
    DoCmd.SelectObject acForm, , True
    If Visible = False Then DoCmd.RunCommand acCmdWindowHide
End Sub
2- This code is used to copy the database, but you need a certain mechanism to take the backup copy of the database automatically at specific intervals
Code:
 FileCopy "Source Full Name", "Destination Full Name"
Abo, in which even should we put this code:
Sub DisplayHideNavPane(Optional Visible As Boolean = True)
DoCmd.SelectObject acForm, , True
If Visible = False Then DoCmd.RunCommand acCmdWindowHide
End Sub

Thank you
 
put this code in module
and call it from anywhere like this
Code:
'for hide
DisplayHideNavPane false
'for show
DisplayHideNavPane true
put this code in module

what would be the name of the module is it standard module?. How can we call it. Thank you for your enlightening me again
 

Users who are viewing this thread

Back
Top Bottom