Using Office 2003 and Windows XP;
I'm in the process of working out some code to create a custom toolbar
whenever a user opens a report, mostly to keep the user interface from
becoming compromised;
Security is not really the issue so much as just trying to keep the user on
track and seeing only the options they should see.
For now the line up of buttons, as I envision, in a Report preview toolbar
will be:
Print; Zoom; Fit; Close; and Office Links
Has anyone out there got some code built to do this, got any tips/tricks,
etc.? Code samples/explantions on how to make the toolbar visible when needed
and vanish when not, shutting down existing toolbars, menus, etc, while in
Print Preview mode?
Thanks much for your input.
XP - 01 Mar 2007 22:11 GMT
I just worked out a little trick: just hide the buttons you don't want to
show on the existing toolbar and you're done; for those interested, my
function appears below; it is called from the report's OnOpen event:
Public Function CustomizePrintPreviewToolbar()
'CUSTOMIZE BUILT-IN PRINT PREVIEW TOOLBAR
CommandBars("Print Preview").Controls(1).Visible = False
CommandBars("Print Preview").Controls(9).Visible = False
CommandBars("Print Preview").Controls(11).Visible = False
CommandBars("Print Preview").Controls(12).Visible = False
CommandBars("Print Preview").Controls(13).Visible = False
CommandBars("Menu Bar").Enabled = False
End Function
The following function runs in the OnClose event of the report:
Public Function ResetPrintPreviewToolbar()
'RESET BUILT-IN PRINT PREVIEW TOOLBAR
CommandBars("Print Preview").Reset
CommandBars("Menu Bar").Enabled = True
End Function
Seems to function royally.
> Using Office 2003 and Windows XP;
>
[quoted text clipped - 16 lines]
>
> Thanks much for your input.
John Spencer - 02 Mar 2007 13:44 GMT
Why don't you just build a custom Toolbar and Menubar and attach it to all
your reports?
In Design view right click on any menu and select customize.
DO NOT Modify the Built-In Preview toolbar
Create a new Toolbar and Control-Drag items from the built-in toolbar to
your new toolbar (that copies the items).
After you save the New toolbar, you can open any report in design view and
on the properties OTHER tab specify a toolbar and menubar for the report.

Signature
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
>I just worked out a little trick: just hide the buttons you don't want to
> show on the existing toolbar and you're done; for those interested, my
[quoted text clipped - 44 lines]
>>
>> Thanks much for your input.
Albert D. Kallal - 03 Mar 2007 00:40 GMT
I had a bar I used for years.
here is a screen shot:
http://www.members.shaw.ca/AlbertKallal/test/test.htm
the new options you see are the print options, and the email options. the
rest other options where simply lifted from the existing preview bar.
so, you just make your own, and add a few options. Fro the printer menus, I
use:
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).
You can use:
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 two printer buttons call the above code. Most of the other buttons
don't need any code...as I just lifted them from the existing report menu
bar...