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

Snapshot of Report changes 1

Status
Not open for further replies.

fredk

Technical User
Jul 26, 2001
708
US
I have a report that has a "status" footer - In the status footer I have code that sums only if the status = "rel to mkt" -

The report is fine, however, when I save it to snapshot viewer, it doubles all of the totals in the status footer - when I print it again, it doubles again. I am pretty sure it has to do with my code in the detail print event which is as follows:

Dim IntX As Integer
Dim lngRowTotal As Long

' If PrintCount is 1, initialize rowTotal variable.
' Add to column totals.
If Me.PrintCount = 1 Then
lngRowTotal = 0

For IntX = 3 To intColumnCount
' Starting at column 3 (first text box with crosstab value),
' compute total for current row in detail section.
lngRowTotal = lngRowTotal + Me("Col" + Format(IntX))
' Add crosstab value to total for current column.
lngRgColumnTotal(IntX) = lngRgColumnTotal(IntX) + Me("Col" + Format(IntX))
If Col1 = "rel to mkt" Then
lngRgColumnTotalRelToMkt(IntX) = lngRgColumnTotalRelToMkt(IntX) + Me("Col" + Format(IntX))
End If

Next IntX

Any help would be greatly appreciated!!!!!

Fred
 
Since this is a crosstab report, I suggest that you look at the crosstab reports at These allow you to total in the same way you would total other fields.

You can do conditional summing with a text box bound to something like:
=Sum(Abs([Status]="rel to mkt") * Quantity)

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks Duane! I figured it out last night.... I needed to re-initialize my variable lngRgColumnTotalRelToMkt(IntX) at the end.... Thanks for helping and I appreciate the link - I am going to check that out now.

I really appreciate your help!!!

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top