refresh report if open?

  • Thread starter Thread starter ms
  • Start date Start date
M

ms

i have an access form/switchboard that opens a report. the
switchboard buttons open the same report but changes the
query that the report is based on so the results are a bit
different depending on which button was pushed.

if the form is already open and i hit another button, it
doesn't refresh the report using the new query. i guess it
sees it's already open so it doesn't continue.

vba code to open report is:
DoCmd.OpenReport "rptProject", acPreview

is there a way to have a report refresh/update itself if
it's already open?

thanks.
ms
 
ms said:
i have an access form/switchboard that opens a report. the
switchboard buttons open the same report but changes the
query that the report is based on so the results are a bit
different depending on which button was pushed.

if the form is already open and i hit another button, it
doesn't refresh the report using the new query. i guess it
sees it's already open so it doesn't continue.

vba code to open report is:
DoCmd.OpenReport "rptProject", acPreview

is there a way to have a report refresh/update itself if
it's already open?


No, not that I ever heard of. A report is a static display
of a snapshot of the data. You should close the report
before opening it again with different data.

There is a fairly complex technique for opening multiple
instances of the same report, but that is only required in
very unusual circumstances.
 
You could have your code look for the report, and if open, close it, before
re-opening.

HTH,
Dave
 
Good suggestion. Do you have any suggestions for how to
have a report run multiple times from a form?

I have a form which captures reporting criteria. When the
<Report> button is pushed, the report opens with the
selected criteria.

I've added a multi-selection list box on the form and
would like the report to run once for each item selected.

The report opens successfully the first time and the code
runs correctly behind the form for the additional
selections, but since the report is already open the
report is not updated for each selection.

I would like the next report to run after the user closes
the current report.

Any ideas?

Thanks.
 
Back
Top