Printing - Variable Keeps Adding

  • Thread starter Thread starter bob barnes
  • Start date Start date
B

bob barnes

I have code to add values in unbound textboxes in the
Detail Section. Each Detail_Format works great to get
the total (this is the result of many condition
evaluations to arrive at each value).

The Integers (Won't need Longs) are reset each time

Private Sub Report_Deactivate()
E = 0: F = 0: G = 0: H = 0
End Sub

Then Re-opening the Report does a new correct calc.

The problem ---> When the Report prints after the opening
Print Preview, "E", "F", "G" & "H" are not reset, so the
printed copies increases 2 times the
original "E", "F", "G" & "H", then 3 times the
original "E", "F", "G" & "H", etc.

How do I reset E = 0: F = 0: G = 0 when Printing the opened
Report? I've tried the Detail_Print & Detail_Retreat
events, but can't reset.

TIA - Bob
 
Silly me..."E", "F", "G" & "H" below are Private "Dims" to
the Report module, so that code is now removed.

Thinkinh of comparing the RecordCount of the Report and
add an Integer (set initially to Zero in Detail_Format),
then if that Integer > RecordCount, no more adding.

Hoping to still set
E = 0: F = 0: G = 0: H = 0
before Printing from the Preview.

TIA - Bob
 
Silly me..."E", "F", "G" & "H" below are Private "Dims" to
the Report module, so that code is now removed.

Thinkinh of comparing the RecordCount of the Report and
add an Integer (set initially to Zero in Detail_Format),
then if that Integer > RecordCount, no more adding.

Hoping to still set
E = 0: F = 0: G = 0: H = 0
before Printing from the Preview.

TIA - Bob
Dim the variables up in the Declaration section.
Option Explicit
Dim E as integer
Dim F as Integer
etc.

Then use the Report's Report Header Format event to reset all the variables
to 0.
 
fredg - Thank you.

Will be there tomorrow & try (had hospital visit today).
Will post back my findings tomorrow.

Bob
 
Back
Top