Is DoCmd.OpenReport syncronous??

B

Bob Howard

Hi all,

In some VBA code behind a form, I issue a DoCmd.OpenReport to print
(AcViewNormal) a report. At some points, it almost appears as if the VBA
code (in the form) regains control even before the report program completes.

I'm not concerned about whether the report physically prints, just that the
report program completes before control is returned. The reason for this is
that the ReportFooter code in the VBA behind the report does some database
stuff that the VBA code in the form is depending upon.

Any clues whether the VBA in the form can regain control before the report
completes??

thanks... !

bob
 
S

Stefan Hoffmann

hi Bob,

Bob said:
Any clues whether the VBA in the form can regain control before the report
completes??
Afaik, yes, but I you cannot rely on it.
The reason for this is that the ReportFooter code in the VBA behind the report does some database stuff that the VBA code in the form is depending upon.
I would use an external procedure to run this code before the report.


mfG
--> stefan <--
 
B

Bob Howard

Thank you Stefan...

The reason I set it up this way is that the specific database update depends
on what occurred during the creation of the report --- and that information
is not known until the time the report footer is ready to format / print.

Based on that information, the calling form's VBA code may want to re-create
the report ... but this time by converting it to a PDF to be emailed. This
is done by the calling form then executing the Lebans code to make the PDF
(this is an Access 2003 application). And that code tries to open the
report again --- but it's not allowed to do so until the prior execution of
the report is totally complete.

In my testing, all works well "almost" all the time. I've only had one case
where an error occurred telling me that I could not open the report at that
time.

[Actually, the second execution of the report is done with an OutputTo, not
an OpenReport.]

bob
 
B

Bob Howard

It's actually not a Windows command I'm executing, but rather producing an
Access report --- I need to ensure that it has completed before continuing
with my VBA code in the calling form. bob
 

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