You simply build a *NEW* menu bar, and then specify that one menu bar for
all reports....
You notice that I have a email button on the report. You could even add a
"pdf" button, and use Stephens example pdf code.
So, I don't actually modify the menu bar..I simply created a new one....
If you wish..you can import that menu bar into your existing
applications..and use it
(just go file->get external data---import)...
You note the "advanced" button to include menu and tool bars for the
import....
(don't forget to import the standard code modules..as those menu bar buttons
use code from the standard code module).
So, noting special was done...just created a standard menu bar...and used
that for the report....
bring up that sample report in design mode..and you see in the "other" tab,
the menu bar is specify in the settings (property sheet...other tab).
The select object command is needed to fix a "focus" bug if you have a form
with a timer function.
For the code that pops up the printer dialog (so the user can change
printers etc). (that is the 2nd button, the code is:
On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint
The select object command is needed to fix a "focus" bug if you have a form
with a timer function.
The code to print right to the printer while in preview mode can be:
On Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll
So, the above code is for the 1st button (Print to a default printer).
Note in the sample you are looking at, the 1st button does not actually use
the above code..but, I simply swiped the print dialog button from an
existing menu bar (so, it actually uses the built-in print command, but I
likely for that example should have used the above code for the button.
Do note that the source code for the menu item that pops up the printer
dialog IS included in the standard code modules in that example (take a look
at the module called RidesReprots).
So, you just have to start playing around and building custom menu bars.
(right click on a menu bar...and select customize). Remember, to shift-key
into the database when you do this....