K
Kon
I have a function redisual() where I put it in a calculated control and
there is a recordset also.
How can I set the variable residualold in order to use it as the previous
record residual.
I used private or public and static declaration but when I move thru records
because the residualold still exists
I have wrong results.
Function residual(sign As Integer, code As Byte, price As Double, f, rs As
DAO.Recordset, keyvalue) As Double
On Error Resume Next
Dim lines As Integer, residualold As Variant, multi as double
If code > 104 And code < 134 Or code = 101 Or code = 102 Then
multi = price * sign
If residualold = residual And rs.BOF = False And code = 101 Or
code = 102 Then GoTo same
residual = residualold + multi
residualold = residual
Else
residual = residualold
End If
GoTo endline
same:
residual = residualold
endline:
rs.MoveNext
lines = lines + 1
If rs.RecordCount = lines Then
residualold = 0
lines = 0
End If
End Function
__________________________________________________________________ iliadisk
ICQ#: 2723633 Current ICQ status: + More ways to contact me
__________________________________________________________________
there is a recordset also.
How can I set the variable residualold in order to use it as the previous
record residual.
I used private or public and static declaration but when I move thru records
because the residualold still exists
I have wrong results.
Function residual(sign As Integer, code As Byte, price As Double, f, rs As
DAO.Recordset, keyvalue) As Double
On Error Resume Next
Dim lines As Integer, residualold As Variant, multi as double
If code > 104 And code < 134 Or code = 101 Or code = 102 Then
multi = price * sign
If residualold = residual And rs.BOF = False And code = 101 Or
code = 102 Then GoTo same
residual = residualold + multi
residualold = residual
Else
residual = residualold
End If
GoTo endline
same:
residual = residualold
endline:
rs.MoveNext
lines = lines + 1
If rs.RecordCount = lines Then
residualold = 0
lines = 0
End If
End Function
__________________________________________________________________ iliadisk
ICQ#: 2723633 Current ICQ status: + More ways to contact me
__________________________________________________________________