ACC2000: Switch report from design view to preview through VBA

  • Thread starter Thread starter Martin Schneider
  • Start date Start date
M

Martin Schneider

Hi!

I create a report at runtime through VBA. Once the report is finished
I'd like to switch to preview view.

Unfortunately there is no .Reports collection in the currentDB object -
how do I switch the view mode at runtime?

Thanks and best regards,
Martin
 
On Wed, 04 Nov 2009 17:55:53 +0100, Martin Schneider

You can close the object, then reopen it in preview mode.

-Tom.
Microsoft Access MVP
 
Tom said:
On Wed, 04 Nov 2009 17:55:53 +0100, Martin Schneider

You can close the object, then reopen it in preview mode.

I don't want to save the report, as the base was created manually, only
some additional fields are being added at run time.

The user can switch to preview mode by clicking the magnifying glass
icon. Can't this action be scripted?

Thanks and best regards,
Martin
 
On Thu, 05 Nov 2009 15:38:27 +0100, Martin Schneider

How about this:
runcommand acCmdLayoutPreview

Or save the object with a temporary name, and reopen it in preview
mode.

-Tom.
Microsoft Access MVP
 
The Application object has the Reports collection.

Presumably you have the object variable referencing your newly created report.

You should be able to use DoCmd.OpenReport with the Name of your report.

-Ken
 
Back
Top