i have a code to check if a status is " Not Paid" in the table then it will SUM it
the problem is its stucking every time i open this form
i am trying to SUM the cash from the table only if the OrdStatus is "Not Paid"
what i am missing here?
what i am doing wrong?
the problem is its stucking every time i open this form
Code:
Private Sub Form_Activate()
Set rs = CN.Execute("SELECT * from Orders")
Do While Not rs.EOF
If rs!OrdStatus = "Not Paid" Then
Set rs = CN.Execute("SUM(OrdPrice) as SumQ FROM Orders")
If rs.EOF Then
LblPayments.Caption = 0
Else
LblPayments.Caption = FormatCurrency(rs!SumQ)
End If
End If
Loop
End Sub
what i am missing here?
what i am doing wrong?