ACC2000: Switch report from design view to preview through VBA

  • Thread starter Martin Schneider
  • 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
 
T

Tom van Stiphout

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
 
M

Martin Schneider

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
 
T

Tom van Stiphout

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
 
K

kismert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top