the Manx Man's MS Access Pages
to subscribe - click here
Previewing Reports (034)
I am taking a break from the unbound forms series and publishing a series
of miscellaneous tips in the next several issues. I received inspiration for many of these
tips from newsgroups and questions that people have sent me. I have used all of these in
one or more of my own projects. Today we will look at previewing reports.
As always, all the code segments assume that you have DAO references
active. If you are not sure what this means, and you are using Access 2000 or higher, click here.
Getting a Form to Wait for a Report Preview
|
'--- open the report in preview mode
DoCmd.OpenReport strReport, acViewPreview'--- as long as the report is
open, wait
If SysCmd(acSysCmdGetObjectState, A_REPORT, strReport) = OBJSTATE_OPEN Then
DoCmd.Maximize '--- maximize the form so that the
report will be as well
Me.Visible = False '--- make the calling form invisible
(optional)
DoEvents
Do While SysCmd(acSysCmdGetObjectState, A_REPORT, strReport) = OBJSTATE_OPEN
DoEvents
Loop
Me.Visible = True
DoCmd.Restore '--- restore form to normal size
DoEvents
End If |
Default the Report Preview to Full Page (or others)
|
'--- open the report in preview mode
DoCmd.OpenReport strReport, acViewPreview'--- change the report's zoom to
show the entire first page
Application.RunCommand acCmdPreviewOnePage
'--- change the zoom to a specific level (choose one of the
following)
DoCmd.RunCommand acCmdZoom10
DoCmd.RunCommand acCmdZoom25
DoCmd.RunCommand acCmdZoom50
DoCmd.RunCommand acCmdZoom75
DoCmd.RunCommand acCmdZoom100
DoCmd.RunCommand acCmdZoom150
DoCmd.RunCommand acCmdZoom200 |
Next Issue
What's next? An article about using Groups in Access security.
|