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!

extra pages in report with subreport

Status
Not open for further replies.

arpeggione

Programmer
Nov 23, 2005
99
US
Hi: I am printing out a 1 page report which is within margins. There is a subreport - a list of names - within the report. When I print out this page...it prints out the same # of pages (of the same thing) as there are records in the subreport. The first page has the header on it. The rest of the pages are just the detail area. The subreport is in the detail report.

For example: if there are 3 records in the subreport:

1st printed page is whole thing including header.
2nd and third printed pages are whole thing (each) minus the header.

Anyone have any ideas about this one? Its not a margin or page length issue....

thank you!

Karen
 
You typically should not have the same record source for you main and subreports. The main report should have only the 'parent' information and the subreport should have the 'child' records.

Duane
Hook'D on Access
MS Access MVP
 
Hi Duane: Thank you for your reply...

the report and subreport do indeed have different recordsources.....

here is the related code in the "open" event of the report:

Me.Controls("subrptContractsCtnr").SourceObject = "subrptContracts"
Me.Controls("subrptContractsCtnr").LinkChildFields = "CAR_ID"
Me.Controls("subrptContractsCtnr").LinkMasterFields = "myCARID"

but....maybe the linking field isn't right somehow....

karen
 
I'll have another look...think about it some more....and post when I figure this out or have more thoughts.

I use the coding in some other reports I've done (I can use the same container for different subreports - handy) - and it has always worked properly.....
 
Duane: You are right....this code doesn't - but it is easily customizable with a conditional if statement and a little add'l code referring to add'l subfrms.

If blah blah A Then
Me.Controls("subrptContractsCtnr").SourceObject = "subrptContracts"
Me.Controls("subrptContractsCtnr").LinkChildFields = "CAR_ID"
Me.Controls("subrptContractsCtnr").LinkMasterFields = "myCARID"
else if blah blah B then
Me.Controls("subrptTestCtnr").SourceObject = "subrptTest"
Me.Controls("subrptTestCtnr").LinkChildFields = "AnotherID"
Me.Controls("subrptTestCtnr").LinkMasterFields = "AnotherID"
end if

I also have subreports that are used for several different reports. This way, I can just load them with code - it just makes life easy....Karen


karen
 
Duane: your first reply was right on the money. I realized that my main report had a query that included subreport information. Now that I've revised the query for the main report, the problem is no longer occurring.

thank you!

regards,
Karen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top