hide the OPTION in file menu in Access - ms-access

Is there a way or vba code to hide the OPTION in file menu in access 2019?
I am hoping someone can give me the VBA code in access 2019 to show the QAT.
In my research I have seen code to hide the main menu/ribbon, and which also hides the QAT:
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
However, I want to keep the QAT and only hide the main menu/ribbon

Related

Hiding the Navigation Pane cause a problem when exiting the database

I just found something strange with MS-Access 2016. I have a database with 2 forms: one hidden, one for a menu. The autoexec will open the hidden form and that one will open the menu form.
I unchecked some options, under Current Database e.g. [Display Navigation Pane] and [Allow Full Menus].
I have an exit button/command on the menu form. On Click, it calls DoCmd.Quit. But before exiting, I am getting an MS-Access window asking for the parameter that is normally when the form open, not when it is closing.
After doing a lot of testing and I mean a lot, I realised that the problem is related to the fact that I am disabling the [Display Navigation Pane]. If I keep the navigation pane, but instead I unchecked all Object Type, then everything works correctly.
So, my question is why disabling the navigation pane can create something like that and is there a way to fix it?
Yes, my solution works, but I don’t like it since users can open and close the navigation pane using the shutter bar; nothing shows but it is still distracting and users can call for support.
The problem is not related to the fact that the first form is hidden, but because it is open. If I add a DoCmd.Close acForm, “F_Parameter” before my DoCmd.Quit then it works.
It is easy to reproduce the problem:
Create a new database
Create two forms:
F_Parameter
F_Menu
Create a Macro named Autoexec:
OpenForm
Form Name: F_Parameter
Window Mode: Hidden
In form F_Parameter create an event On Load
Private Sub Form_Load()
DoCmd.OpenForm “F_Menu”
End Sub
In form F_Menu create a Button named Btn_Exit with an event On Click
Private Sub Btn_Exit_Click()
DoCmd.Quit
End Sub
In form F_Menu create an event On Load
Private Sub Form_Load()
MsgBox “Hello”
End Sub
go File, Options, Current Database and
uncheck Display Navigation Pane and
uncheck Allow Full Menus
Save, exit and open the database:
You will get a “Hello” because the F_Menu form open, now click on the exit and you will get another “Hello”. This second one should not be there because the form should be closing not opening.
I was able to reproduce the issue described. I don't think it has anything to do with the Navigation Pane.
This is happening because while the DoCmd.Quit event is occurring, the hidden F_Parameter form is becoming "unhidden" in order for Access to close it. This causes the F_Parameter Form.Load event to run, which is essentially opening F_Menu, thus causing the Form.Load event on F_Menu to run.
I was able to solve this by first explicitly closing F_Parameter, then quitting:
DoCmd.Close ObjectType:=acForm, ObjectName:="F_Parameter", Save:=acSaveNo
DoCmd.Quit

lock navigate pane in ms access

We are working on a project in MS-Access 2010, where users will be using switchboard as a main menu for navigation and will work in forms. We protected each form with login and password so the user can only access his/her records in a form (using vba macro inside MS-Access).
Now we would like to lock the control pane so noone can access objects like tables and queries. Does anyone have an idea how to do it in MS-Access?
Thanks for any ideas.
Home>Options>CurrentDatabase>
uncheck 'Use Access special keys'
uncheck 'Display Navigation Pane'
And perhaps also:
uncheck 'Allow full menus'
uncheck 'Allow default shortcut menus'
build custom ribbon
make sure users don't know about shift key bypass or else distribute executable ACCDE
if you are looking to do this programatically, then this will do it:
Call DoCmd.LockNavigationPane(True)
however, you are probably better off hiding the navigation window and also following some of the suggestions by June7.
An easy solution couild be simply setting the forms modal property to true in the form opening event like so:
Private Sub Form_Open(Cancel As Integer)
' Go Modal to Lock Navigation Pane
Me.Form.Modal = True
' Hide Navigation Pane
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
' Hide Ribbon
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Sub
Granted setting a form to Modal may not fit every situation but if you have a startup/ switchboard style form which opens all other forms then this could be a solution for you.

Access Navigation Control BrowseTo "The command or action 'BrowseTo' isn't available now. Error 2046

Using MSAccess 2016 64 bit with SQL SERVER Express 2014 backend.
I have a form "frm_Navigation" with a subform control "NavigationSubform" and a Navigation control.
There are several forms for different tasks within the database that are loaded into the NavigationSubform by clicking the buttons on the Navigation control.
Some of the navigation is managed from the Navigation Control, but some is initiated from a subform. When the user clicks a button on the control, it appears "pressed", but when I navigate using the following, I am not able to make the button appear pressed without changing the colour on the button.
This is how I am currently navigation from a subform:
Form_frm_Navigation.NavigationSubform.SourceObject = "frm_SearchResults"
Form_frm_Navigation.lbl_Header.Caption = "Search Results"
I have read the following posts, but sadly I'm not able to accomplish what I am trying to do
https://blogs.office.com/2010/02/23/access-2010-browseto-docmd-and-macro-action/
http://www.utteraccess.com/forum/index.php?showtopic=1986422
navigating to a different tab in navigation subform
Opening subform within navigations (ELI5)
Main form: frm_Navigation
subform Control on Main from: NavigationSubform
Subform containing code: frm_Search
Form I am trying to open: frm_SearchResults
DoCmd.BrowseTo acBrowseToForm, "frm_SearchResults", "frm_Navigation.NavigationSubform"
Error '2046': The command or action "BrowseTo" isn't available now.
Expected outcome: frm_Search is loaded in the subform control of frm_Navigation by default. After the user enters criteria in the search fields on the frm_Search and clicks btn_search the results are populated into a table, then the frm_SearchResults is opened to display the found records.
I have tried setting the focus to the Main form first, clearing the source of the NavigationSubform, setting the source of the NavigationSubform to the form I am trying to open (I read somewhere that the form must be open) and several permutations of the BrowseTo arguments.
EDIT 2016-07-04 16:04 GMT
It works now as long as the Navigation form is first closed, then reopened. It is not elegant, but the Navigation button now lights up to indicate which is "selected".
Excerpt of code in "frm_Search", a subform of "frm_Navigation" occupying the "frm_Navigation.NavigationSubform"
Is there a way to achieve this without closing the navigation form?
DoCmd.Close
DoCmd.OpenForm "frm_Navigation"
DoCmd.BrowseTo acBrowseToForm, "frm_SearchResults", "frm_Navigation.NavigationSubform"

Access Popup Form Not Displaying Textbox

I'm running Access 2016. Using VBA I have a popup form which displays just before initiating a lengthy copy operation. Once the copy completes, I close the popup. The problem is that popup only displays the form's caption and not the contents of the form (which is a yellow background with a label containing "Backup in progress"). The form displays properly if I manually open it. I can't figure out what's going wrong. Here's the code that executes:
DoCmd.OpenForm "frmBackupInProgress"
fso.CopyFile strOldPath, strNewPath
DoCmd.Close acForm, "frmBackupInProgress"
Any suggestions would be greatly appreciated.
-- Geoff
I found that I needed to add a "DoEvents" command before the CopyFile to get it to display.

How to start with a blank main window?

I want to write some VBA script so that when I start my access application the main window is blank. This is the list of things I need to be removed or hidden:
The entire ribbon
The status bar
The navigation pane
The window tabs
In addition, I want to disable the popup menu when right clicking.
I also want to disable SHIFT bypass key startup.
I basically want it to look like an application created with VB or C#.
Only if I login as admin will the disabled options be bypassed.
Does it need to be VBA? Why not using the normal Access Application Options?
In Access 2010 you can find them via File > Options > Current Database. Almost all the things you want can just be unchecked - see the following screenshot. The options you select there are saved with your database.
You can start the database while holding SHIFT which will override these start up options and show you your "normal" ribbon, status bar, navigation bar, ...
Try the following in startup function
This should do what you want
DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Status Bar", acToolbarNo
Might work with other MS Access windows elements, I just wanted to not display the parts above.
Old thread but still useful information. Here's what I do:
DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Status Bar", acToolbarNo
DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
Put that code in a Public Sub called from a macro called AutoExec.
Disabling Window Tabs and the Shift Bypass are trickier because these need to be done by setting the database property, either through the database Properties or by appending a property with CreateProperty. Also, you need to exit and reopen the database for these changes to take effect.
I found instructions over on techrepublic and Allen Browne has more complete instructions on his website.
Actually, as noted, you can use the startup options to remove most all of the questions you have in terms of popups, the tabs etc.
To hide ribbon, qat, just use:
DoCmd.ShowToolbar "Ribbon", acToolbarNo
So, with the options setup correct and ONE line of code, you only see your form.
Here is an resulting screen shot of using the above one line of code and options to turn off tabs (you want tabbed windows, but tabs turned off). Note how you see the windows desktop. this was all done with one line of code as per above: