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

Code works in Preview mode, but not in Print mode

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
The code below is designed to pull totals into the Page Footer. The code works perfectly in Preview mode but the totals don't show in Print mode.

Although I changed methods, I would still like to know why the totals won't show in Print mode.

Code:
Option Compare Database
Option Explicit
Dim x As Currency
Dim y As Currency
Dim z As Currency
Dim i As Currency
Dim h As Currency

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
PageSumPMT = RunSumPMT - x
x = RunSumPMT
PageSumCOPAY = RunSumCOPAY - y
y = RunSumCOPAY
PageSumADJ = RunSumADJ - z
z = RunSumADJ
PageSumDEDUCT = RunSumDeduct - i
i = RunSumDeduct
PageSumTotalPayments = RunSumTotalPayments - h
h = RunSumTotalPayments

End Sub

Any clues?

Thanks.

Tom
 
what are these controls you're assigning sums to, Textboxes/charts?

also, have you tried putting this in the onFormat event instead of the print event?

--------------------
Procrastinate Now!
 
Crowley16
The controls are Text boxes.

If you put the code on the OnFormat event instead of the OnPrint event, the totals don't show at all, in either Preview or Print mode.

It's just a weird thing. The totals show perfectly in Preview Mode but not in Print mode.

Don't spend a lot of time on this. As I indicated, I pulled a different method off the MSKB site, modified it and it works fine.
I was just seeking to understand why the anomoly between Preview and Print mode. I would understand if the forms from which the report is called was being closed prior to the report being formatted, but that's not the case.

Thanks for your suggestions.

Tom
 
I am having a similar problem. What was your modified solution, can you please head me in the right direction?
I have a text box that I have set up with an IIF to display different text on my last page, and then a report footer that I only want to see under certain conditions. As with your case, my report previews beautifully, looks exactly as I would like it to, but when it prints it does not retain the same format/text etc.
 
cac2
Go to this link and have a look at the Microsoft Knowledge Base article - how to create page totals in a report.


Actually, there's a bit simpler way than this even, but I don't have it in front of me right now. If you need more help, let me know, and I'll shoot the other solution to you.

Tom
 
cac2
Here's the alternate (simpler) approach.

1. Create the following event procedure in the Format event of the Page Header section:
Code:
Private Sub PageHeader0_Format(Cancel as Integer, FormatCount as Integer)
     [txtPageTotal] = 0
End Sub

2. Create the following event procedure in the Format event of the Report Header section:
Code:
Private Sub ReportHeader0_Format(Cancel as Integer, FormatCount as Integer)
     [txtPageTotal] = 0
End Sub

3. Create an event procedure in the OnPrint event for the Detail section:
Code:
Private Sub Detail1_Print (Cancel as Integer, PrintCount as Integer)
     [txtPageTotal] = [txtPageTotal] + [YourField]
End Sub

Substitute, of course, what I have shown as [YourField] with the field you want to total.
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top