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!

Two-page report with one difference between the two

Status
Not open for further replies.

breezett93

Technical User
Jun 24, 2015
128
US
Hello


One of our reports currently has additional data on it that is intended for the customer only. To fix this, I am hoping to basically copy the report to a second page. Then on that second page, I can make that data invisible.


Where should I put the page break to get a second page?


Thanks.
 
You can place the page break where ever you want. I would probably add some code to set the visible property of controls to No for controls I wanted to hide.

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
I added in the page break, but no additional work-space is created for me to duplicate the report.

I'm attaching a picture to give a general idea of what I'm trying to do.

QW4mG6U.png


I want the two pages to be identical, but page two just has a couple controls set to be non-visible. I can get the controls set to how I want them, but I can't get a duplicate page to show up.
 
Another approach would be to run the report twice, first time controls visible, second time controls not visible if this is run number 2.
 
So you are printing all of this in one report like a copy for customer and copy for you?

I would create a small
[pre]tblCopies
CopyNum CopyTitle
------- ---------
1 Customer
2 Us[/pre]

Make a copy of the report design...
Then add this table to your report's record source and don't join it to anything. This will create duplicates of every record. Add both new fields to the record source.

Add a group on CopyNum in your report's design. You can then change your control sources of the switchable controls to something like:
[pre]=IIf([CopyNum]=1,"",[Field1 To Hide])
=IIf([CopyNum]=1,"",[Field2 To Hide])[/pre]

You could also set the tag property of controls to hide to something like
Tag: HideMe
Then use code to check for HideMe in the tag and set the Visible property based on CopyNum. I believe CopyNum would need to be bound to a control in the report.



Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
Couldn't this be done with one report and no table? In the vba for the print event, have a hidden text box on the form or do an open args in second print statement.
Pseudo code for form text box approach (assuming this is a button click event:
Code:
'put in before first print statement
me.txtCopyNum=1 'reset copynum to 1
docmd.print etc....
me.txtCopyNum=2
docmd.print etc...

Then in the report as Duane showed:
Code:
=IIf(Forms!YourFormName.txtCopyNum=1,"",[Field1 To Hide])
=IIf(Forms!YourFormName.txtCopyNum=1,"",[Field2 To Hide])

 
Sorry for the long delay. Priorities got diverted.

I have copied the report and saved it as a second report. Then I added the second report as a subreport in the report footer of the main report.

The only remaining problem I am having is that the page header is displayed on the same page as when the subreport begins. How can I access the VBA to add some code to turn all those controls in the page header off only on the page that the subreport begins?
 
So you didn't take advice from either me or sxschech?

Did you try my method?

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
Sxschech suggested that I run the report twice; so I thought he was suggesting the subreport option.

A quick solution was needed, which is why I chose Sxschech's, because this report is used daily. Now that it's in a somewhat usable state, I can try implementing your suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top