K
Kon
Generally I need a residual (amount * sign) with complicated conditions (If
code > 104 And code < 134 Or code = 101 Or code = 102 Then and If
residualold = residual And rs.BOF = False And code = 101 Or code = 102 Then)
Dsum doesn't work where residualold is the previous record residual and rs
is a recordsetclone to put it in a calculated form.
I tried hard to find a solution but nothing happened. Please help me.
Here is a custom function that I made.
Function residual(sign As Integer, code As Byte, price As Double, f, rs As
DAO.Recordset, keyvalue) As Double
On Error Resume Next
Dim 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
End Function
code > 104 And code < 134 Or code = 101 Or code = 102 Then and If
residualold = residual And rs.BOF = False And code = 101 Or code = 102 Then)
Dsum doesn't work where residualold is the previous record residual and rs
is a recordsetclone to put it in a calculated form.
I tried hard to find a solution but nothing happened. Please help me.
Here is a custom function that I made.
Function residual(sign As Integer, code As Byte, price As Double, f, rs As
DAO.Recordset, keyvalue) As Double
On Error Resume Next
Dim 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
End Function