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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending to an Access Report 1

Status
Not open for further replies.

rookie52

Programmer
Sep 29, 2004
7
0
0
AU
Hi Everyone,

I have a program that uses a loop to generate information.

Here is an overview
Outer Loop (using counter X)
Inner Loop (using counter y)
generate query using variables X & Y
execute query
call report function
End Inner Loop
End Outer Loop

At the moment, all the information prints out correctly in the Debug window, but only the results from the first loop are displayed in the report. Basically I'm wondering the best way to create a report using this program structure? Ideally I would like to avoid generating a different report for each loop (the loop could execute up to 50 times.)

The possible solutions I've condidered include
* appending to the open report within the inner loop.
* Instead of using the control source to populate the report, is there a way to add each record in the recordsource with manual coding?
* write to a text file then use the text file to populate the report.

But I don't really know how to implement any of them.

I think the appending to the report would be the best solution, but I'm open to ideas!

Please help!
Renee


 
A quick thought ...

Could you write the results calculated in each loop, into a table? You could then run a report against the table once the loops were finished. This would guarantee just one report, containing all the calculation results. The outline structure would be:

Code:
Delete records from results table

Outer Loop (using counter X)
      Inner Loop (using counter y)
            generate query using variables X & Y
            execute append query - post record
      End Inner Loop
End Outer Loop

Call report function - report on results table

I hope that this idea is of some use.


Bob Stubbs
 
I can't believe I didn't think of that. I was trying to add things into the report as I generated them, but adding them to a table, and using the table to generate the report is an excellent idea... Not that I've got the report behaving itself just yet, but it's on it's way.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top