A
AaronWestcott via AccessMonster.com
Folk,
I hope that someone will be able to help with my challenge.
I have a report that groups on city names. Within each group I have anywhere
from 1 to 12 rows of data to be displayed. Part of the data shown is the
percentage change from the previous records corresponding field. This
percentage change is calculated using the format and print events, a trick I
learned off of this forum
using the following code.
Dim ValPreviousValue As Double
Dim WghtPreviousValue As Double
Dim NYValPreviousValue As Double
Dim NYWghtPreviousValue As Double
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(ValPreviousValue) Or ValPreviousValue = 0 Or IsNull
(WghtPreviousValue) Or WghtPreviousValue = 0 Or IsNull(NYWghtPreviousValue)
Or NYWghtPreviousValue = 0 Or IsNull(NYValPreviousValue) Or
NYValPreviousValue = 0 Then
Me.txtTotVal = "N/A"
Me.txtTotShip = "N/A"
Me.txtNYVal = "N/A"
Me.txtNYShip = "N/A"
Else
Me.txtTotVal = (Me.Total_Value) / ValPreviousValue - 1
Me.txtTotShip = (Me.Total_Ship_Weight) / WghtPreviousValue - 1
Me.txtNYVal = (Me.DESTNY_Value) / NYValPreviousValue - 1
Me.txtNYShip = (Me.DESTNY_Ship_Weight) / NYWghtPreviousValue - 1
End If
End Sub
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
ValPreviousValue = Me.Total_Value
WghtPreviousValue = Me.Total_Ship_Weight
NYValPreviousValue = Me.DESTNY_Value
NYWghtPreviousValue = Me.DESTNY_Ship_Weight
End Sub
The challenge is that I need to have the "PreviousValue" variables reset to 0
when a new group starts. Is this possible? If so, how?
Best Regards and thank you for any help you all can provide.
Aaron
I hope that someone will be able to help with my challenge.
I have a report that groups on city names. Within each group I have anywhere
from 1 to 12 rows of data to be displayed. Part of the data shown is the
percentage change from the previous records corresponding field. This
percentage change is calculated using the format and print events, a trick I
learned off of this forum
Dim ValPreviousValue As Double
Dim WghtPreviousValue As Double
Dim NYValPreviousValue As Double
Dim NYWghtPreviousValue As Double
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(ValPreviousValue) Or ValPreviousValue = 0 Or IsNull
(WghtPreviousValue) Or WghtPreviousValue = 0 Or IsNull(NYWghtPreviousValue)
Or NYWghtPreviousValue = 0 Or IsNull(NYValPreviousValue) Or
NYValPreviousValue = 0 Then
Me.txtTotVal = "N/A"
Me.txtTotShip = "N/A"
Me.txtNYVal = "N/A"
Me.txtNYShip = "N/A"
Else
Me.txtTotVal = (Me.Total_Value) / ValPreviousValue - 1
Me.txtTotShip = (Me.Total_Ship_Weight) / WghtPreviousValue - 1
Me.txtNYVal = (Me.DESTNY_Value) / NYValPreviousValue - 1
Me.txtNYShip = (Me.DESTNY_Ship_Weight) / NYWghtPreviousValue - 1
End If
End Sub
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
ValPreviousValue = Me.Total_Value
WghtPreviousValue = Me.Total_Ship_Weight
NYValPreviousValue = Me.DESTNY_Value
NYWghtPreviousValue = Me.DESTNY_Ship_Weight
End Sub
The challenge is that I need to have the "PreviousValue" variables reset to 0
when a new group starts. Is this possible? If so, how?
Best Regards and thank you for any help you all can provide.
Aaron