Modules to Hide and Show Ribbon & Backup database BackEnd (1 Viewer)

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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

  • SimpleLogin_A_R1.accdb
    704 KB · Views: 223

theDBguy

I’m here to help
Staff member
Local time
Today, 09:24
Joined
Oct 29, 2018
Messages
18,989
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:

vhung

Member
Local time
Today, 09:24
Joined
Jul 8, 2020
Messages
236
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
 

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:24
Joined
Oct 29, 2018
Messages
18,989
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
 

isladogs

CID VIP
Local time
Today, 17:24
Joined
Jan 14, 2017
Messages
16,240

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:24
Joined
Feb 19, 2002
Messages
36,340
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

Member
Local time
Today, 09:24
Joined
Jul 8, 2020
Messages
236
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
 

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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

  • SimpleLogin_A_R1.accdb
    708 KB · Views: 261

vhung

Member
Local time
Today, 09:24
Joined
Jul 8, 2020
Messages
236
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

Member
Local time
Today, 09:24
Joined
Jul 8, 2020
Messages
236
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:

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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
 

vhung

Member
Local time
Today, 09:24
Joined
Jul 8, 2020
Messages
236
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:
 

Abo Abd_Allah

New member
Local time
Today, 19:24
Joined
Sep 23, 2016
Messages
16
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"
 

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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
 

hfsitumo2001

Member
Local time
Today, 09:24
Joined
Jan 17, 2021
Messages
310
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

Top Bottom