Home Page
Policies
Policies
About
Tips And Tricks
Helpful Links
e-mail me

Picture of building from outside Tips And Tricks

I seem to run into things from time to time that I want to share with the world, usually things that I had to find out the hard way. Sometimes it will just be something that I had to dig for, and want to make more readily accessible. This page is intended to make life a little easier for other programmers. If it meets your need, then that's what it's here for.



Disable Full Menus Without Disabling "Send To" or "Mail Recipient"

The other day, something happened that gave us a new motivation to change the way we do things. For a long time, we had allowed the database window to show up behind our forms, and allowed full menus to be accessed, which enabled our users to email reports with ease. All they had to do was pull down the file menu and use the "Send To", "Mail Recipient (As Attachment) ..." option. If we had a support issue and wanted to get to tables at table level, it was very convenient for us.

It seemed, however, that some data might possibly have been altered at table level, and it began to be clear to us that table level access was just a little too easy for any of our users. That prompted us to begin making table level access to our data less available.

So I wrote some code to turn off "Full menus" and to hide the database window. Now, we didn't want these disabled in our development environment, so I used the code detailed elsewhere on this site to change those startup properties before the program gets compiled, in preparation to publishing it.

Having done that, though, our users would no longer have the ability to easily use the "Send To", "Mail Recipient (As Attachment) ..." option on the built "File" menu. That option disappears when full menus are disabled. See below:

Image of MS Access With and Without Full Menus

That seemed like a simple enough problem to solve, since we could place the email option on a custom file menu in our application's menu bar. As we began constructing this custom file menu, however, we ran into yet another problem. It seems that there is no easy way to place the genuine "File Print" option provided by Access on a custom menu bar and have it show up when full menus are turned off. (I did manage to move it off of the system file menu onto our custom menu, but it still wouldn't show up when full menus were disabled) Seems like the only print option available in the "Commands" tab under "Customize" is one that sends output to the default printer immediately, and doesn't give the user a chance to choose which printer to send the output to.

There really doesn't seem to be much information about this on the web, and I searched a number of ways. I tried the following search terms, and several others as well:

"Microsoft Access" Turn Off "Full Menu" "send mail"

There was a link on that one that looked correct, but didn't seem to be working that day. It did, however show the following in the short excerpt of the content at that link:

Disable Full Menu Without Disabling Send To Mail Recipient Subme. . .

So I put that in, and finally did find a link that seemed to at least partially address our issue. There is a discussion about a way to turn on full menus only for some users. It involved a button on a form to turn full menus on and off for users with more privileges.

Our situation did not call for some users to have access to full menus, but rather to allow most users easy access to the option to send reports as email. (One could, of course, debate the relative merits of allowing and disallowing various options such as the shift key, but our goal here was to prevent an obvious and easy access to the table level data for average users, and the shift key bypass is only obvious after you know about it)

My associate came up with a way to have a custom menu with an option for users to initiate something similar to the "File Print" dialog. He created a macro called, "PrintDialog" which contained a single action "RunCommand" with a the command "Print".

Image of MS Access Macro To Initiate File Print Dialog Without Full Menus

Not realizing that he had already solved the problem, I wrote a function to handle the issue in a slightly different way.
Function RunFilePrint()
 DoCmd.RunCommand acCmdPrint
End Function
This function would then be called from our "Print" option on our custom "File" menu, which also has other options on it that we want our users to be able to use. See below:

Sample Call:

Image of MS Access Custom File Menu Properties

Either of these methods provides the ability to use both the "Send To" option and the "Print" option. We were already using the "=RunFilePrint()" syntax in custom menus to be able to call forms through a reference without having to build a macro for every form.

So after all is said and done, here is a picture of what the custom menu looks like without the properties windows up. I have left the database window showing rather than the "MainMenu" form to make things more generic.

Image of MS Access Custom File Menu


If you found this information to be useful, and would like to donate via PayPal to help offset the cost of maintaining this web site, use the following button:



|Home Page| |Custom Software| |Policies| |About| |Tips And Tricks| |Helpful Links|