Full Version: 'Double Loop' in MS Access Report?
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
yisraelharris
I need to write an MS Access Report which, for a given supplier record, first lists all invoice records for that supplier and then lists all branch records for that supplier. (Note that although invoice records and branch records are both related to supplier records, invoice records and branch records are in no way related to each other.)

If I only had to list all invoice records, I would know how to do it. But with this 'double loop', I have no idea where to start. Any ideas would be welcome.
GatorzLair
Should be pretty easy. Simple Create a main report the returns the information you need for the Supplier such as name and address etc... Then create a subreprot that is filterd by the related info for the supplier to each of the tables.

You will have a Report with Two supreports.
yisraelharris
Okay. Now how do I create a subreport? Based on your answer, I still don't see the answer to my question, namely, how to get it to list all of the supplier records and then below that all of the branch records?
GatorzLair
Going on your statement that each table both the invoice and branch records have relationships with the supplier table.

1. Create a report either on the table of the supplier with needed information, or a query.(include the primary key in this report that ties the 3 table together. If you don't want this field visible you can hide it)

2. Use toolbox for reports and select supreport. Use a query that you have created for the information that you need to convey. With in the suberport wizard it will ask what criteria you wish to sort by this is where you are going to select the Primary key and foreign key for the two tables to filter by.

3. Repeat step 2 for the second subreport.

Hope this helps.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.