G
Guest
Here is the code I have. The FillArray procedure loads up an array with
values from a Record set on a Tabular form. (Thanks to Carl Colijn for
helping me get the FillArray set up.)
Private Sub FillArray()
Dim RecordNr As Long
If Not Recordset.EOF And Not Recordset.BOF Then
Recordset.MoveLast
End If
If Recordset.RecordCount > 0 Then
ReDim ValArr(Recordset.RecordCount)
Recordset.MoveFirst
RecordNr = 0
While Not Recordset.EOF
ValArr(RecordNr) = Margin
RecordNr = RecordNr + 1
Recordset.MoveNext
Wend
End If
End Sub
Here is the ArrMath procedure it works good upto the last Record set in
which it displays that Record sets Margin value as a negative number when I
need it subtracted from the previous Record sets Margin value, and then
display the proper value in the final Record sets Net_Change box.
Private Sub ArrMath()
Dim RecordNr As Long
RecordNr = 0
Recordset.MoveFirst
Net_Change = ValArr(0)
For RecordNr = 1 To UBound(ValArr)
Recordset.MoveNext
Net_Change = ValArr(RecordNr) - ValArr(RecordNr - 1)
Next
End Sub
How it displaying on the form is like this:
Margin Net_Change
500 +500
1000 +500
1200 -1200
It should look like this:
Margin Net_Change
500 +500
1000 +500
1200 +200
Any more help would, and is greatly appreciated.
C_Ascheman
values from a Record set on a Tabular form. (Thanks to Carl Colijn for
helping me get the FillArray set up.)
Private Sub FillArray()
Dim RecordNr As Long
If Not Recordset.EOF And Not Recordset.BOF Then
Recordset.MoveLast
End If
If Recordset.RecordCount > 0 Then
ReDim ValArr(Recordset.RecordCount)
Recordset.MoveFirst
RecordNr = 0
While Not Recordset.EOF
ValArr(RecordNr) = Margin
RecordNr = RecordNr + 1
Recordset.MoveNext
Wend
End If
End Sub
Here is the ArrMath procedure it works good upto the last Record set in
which it displays that Record sets Margin value as a negative number when I
need it subtracted from the previous Record sets Margin value, and then
display the proper value in the final Record sets Net_Change box.
Private Sub ArrMath()
Dim RecordNr As Long
RecordNr = 0
Recordset.MoveFirst
Net_Change = ValArr(0)
For RecordNr = 1 To UBound(ValArr)
Recordset.MoveNext
Net_Change = ValArr(RecordNr) - ValArr(RecordNr - 1)
Next
End Sub
How it displaying on the form is like this:
Margin Net_Change
500 +500
1000 +500
1200 -1200
It should look like this:
Margin Net_Change
500 +500
1000 +500
1200 +200
Any more help would, and is greatly appreciated.
C_Ascheman