Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening report from vba code in a loop

Status
Not open for further replies.

mortgsteps

Technical User
Apr 19, 2000
19
US
I have a for next loop with a count_variable set to 5 like this:

for x = 1 to count_variable
docmd.openreport reportname(x),acpreview,,key = key_number
next x

The code runs fine except each report previews on the one before it so i end up with 5 reports in preview one on top of another.
I want it to preview on report - allow the user to print or close and then preview the next report
any ideas?
thanks [sig][/sig]
 
and the problem is?

from the perspective of "been there - donr that", the only issue is the "perception" of your user(s). They can still review and decide on each individual report - they just need to be aware of the process and make sure they are REVIEWING the report to decide if they want to print it or not.

A little bit of education here can save you a LOT of work around programming!!!

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
The problem is that the loop might be extended to 25 or 30 reports not just 5 - which overlays one on the other 30 times
any other suggestions
thanks for your help [sig][/sig]
 
Again, SO WHAT?

If the user is expected to review and decide - for each object (report?) wheather to do something (print it or not), then the user just has to look at each of the objects (reports) who cares HOW many there are? Its not as if you were giving him (the reviewer) the option of looking a specific reports now and some others at a later time. They JUST are being presented as &quot;FACT&quot; for his review - as a group.

[red]If[/red] you wnat to give him choices, set up a form which has a check box and text box arrays. Each check box has the report title as it's caption and each text box has the Date/Time the associated report was reviewed. Let HIMSELF decide what to review/print - and when. Give him some info on the report(s) to aid in the decision.

Also, you could consider doing some summary report which gave the critical info for each of the reports, so HIMSELF could review this prior to bringing up the finals for printing.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
There is another possible method: within the For loop, after the call to display the report, place a while loop to loop while the report exists in the &quot;Reports&quot; collection. Theoretically this will work and this is what you are asking for (a method to wait for the user to finish with each report before continuing on). However, due to the use of threads in Windows; Access may blotch this up and cause an infinite loop, hanging the program. I have not tested this but give it a try. You can loop through the reports collection and check each object's name to see if it matches your &quot;reportname(x)&quot;.

CCTC1
Rob Marriott
rob@career-connections.net [sig][/sig]
 
Another solution if you like.

I have a form that loops through the reports collection and produces a listbox with all available reports listed. These can then be previewed or printed as the user requires.

It's a generic form, written by Brad Darragh and released for use by all, subject to the &quot;credit where credit is due&quot; proviso. Just copy it into your application and it's ready to go.

If you'd like a copy, post your e-mail address and I'll send it to you.

Lightning [sig][/sig]
 
thanks, everyone
lightning that would be great
please send to mortgsteps@aol.com - i really appreciate all your help [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top