Solved

data on subreport expands to multiple pages

Posted on 2009-05-11
9
213 Views
Last Modified: 2012-08-13
I have a report that is based on a query and it displays only the current record that i want to view....i have added 2 sub reports to it but i am having a problem with those:

- when there is only 1 or no data entry in each of the subreport the main report shows up fine and i can see only the record that i want to see on one page
- but if there is more then one entry in any of the subreports the page number gets multiplied by that i.e. if there are 2 records in any subreport i get 2 pages of the report containing the exact same data along with the subreport having the exact same data

what i want is the report to just show the record that it is on and also just expand the subreports if there is more data rather then giving me multiple pages of the same data
0
Comment
Question by:samipk
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 3

Expert Comment

by:coleventures
ID: 24352326
When setting up a subform we have to set up the relationship between the form and the subform.
In reporting as well, we have to identify the Master Field and the Child Field so we don't run into the duplication error you are experiencing.

Suppose in your report 'ID' is the key field of the main report and 'OrderID' is the key field of the subreport.  If they are the common field then enter "ID" in Link Master Field and "OrderID" in the Link Child Field.

Point to the object which is the subreport and right-click, choosing Properties and go to data tab to find the Link Fields.

Robert
Louisiana USA
LinkFields.jpg
0
 
LVL 6

Author Comment

by:samipk
ID: 24352675
i have already defined those and the data is linked perfectly the only thing is that is shows the same data multiple times depending on the number of records in the subreport for e.g. if the subreport has 4 records it will shows the whole report along with the subreports 4 times on 4 different pages

here is the query the report is based on...it just shows data for the current record on the form

SELECT tblcorp.clientname, tblcorp.contactperson, tblcorp.telephone, tblcorp.tradingaccno, tblcorp.cdcaccno, tblcorp.memorandum, tblcorp.boardresolution, tblcorp.Specimen, tblcorp.poaauth, tblcorp.a4dc, tblcorp.thankyou, tblcorp.dateofaccopening, tblcorp.uin, tblcorp.address, tblcorp.active, tblcorp.commslab, tblcorp.lowerlock, tblcorp.upperlock, tblcorp.dateofclosing, tblcorp.reasonforclosing, tblcorpcomm.changedate AS tblcorpcomm_changedate, tblcorpcomm.prevupperlock, tblcorpcomm.newupperlock, tblcorpcomm.prevlowerlock, tblcorpcomm.newlowerlock, tblcorpcomm.prevcommslab, tblcorpcomm.newcommslab, tblcorpsalesper.changedate AS tblcorpsalesper_changedate, tblcorpsalesper.oldsalesperson, tblcorpsalesper.newsalesperson, tblcorpsalesper.reasonforchange
FROM (tblcorp LEFT JOIN tblcorpcomm ON tblcorp.tradingaccno=tblcorpcomm.tradingaccno) LEFT JOIN tblcorpsalesper ON tblcorp.tradingaccno=tblcorpsalesper.tradingaccno
WHERE (((tblcorp.tradingaccno)=[Forms]![frmcorp]![tradingaccno]));

Open in new window

0
 
LVL 84
ID: 24353192
If your subreport is showing up for EACH related record, then either (a) your subreport recordsource is incorrect or (b) your report or subreport's Groupings are incorrect or (c) as Robert said, your master/child links are incorrect or missing.

Have you added any grouping to the subreport? any to the main report?

I assume the SQL you posted above is for the main report? Can you show the SQL for the subreport?
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 3

Expert Comment

by:coleventures
ID: 24353958
At least show us the Property Sheet of each of the subreports.
(i.e. include a graphic of each with their Link Master Field and Link Child Field filled in)
0
 
LVL 6

Author Comment

by:samipk
ID: 24360843
@LSMConsulting:i just dragged and dropped the form in the report and as the relationship is defined it linked to the table perfectly...as for the sql it is just has  the recordsource set to the corresponding table

@coleventures: i am attaching screenshots....tblcorpcomm is the table source of the subreport and tblcorp is the main table which has the primary key
1.JPG
2.JPG
3.JPG
0
 
LVL 84
ID: 24363261
What are the Recordsources for the SubReports?
0
 
LVL 6

Author Comment

by:samipk
ID: 24371162
there isnt any...its strange but i am able to get the record source option for the report but am not getting any for the subreport ...all i get is the detail i gave in the above screenshot....i am sorry to be such a nob but i just started using reports
0
 
LVL 3

Accepted Solution

by:
DK_User earned 500 total points
ID: 24401032
If the image 3.jpg is a query, then thats the problem.

Your Top report should have this sql
SELECT * FROM tblCorp.
Since it seems that you want to show the tradingacc regardless of records in corpcomm and corpsalesper, no other tables should be in that query.

Your subreports should have this:
SELECT * FROM tblcorpcomm
SELECT * FROM tblcorpsalesper

And then LinkMaster/LinkChildfields should be set, as mentioned in the other posts.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA to copy the database back end to a new database file. 3 36
Access Crosstab Query with Multiple Values 4 32
Calculation in Access 5 27
Modify report 8 11
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question