Hi everyone,
I have a little problem. So i'm working on a DB where it keeps track of loans and if a balance is still unpaid after 10 days then a late fee of $100 is added to it. The code in red below I have running on Open of the form and it works but obviously it updates EVERY time you open the form.
What I need it to do is update, but update only once per record. Basically:
If (Record hasn't been updated before) Then
If Me.[DateDue] < DateSerial(Year(Date), Month(Date), Day(Date) - 10) And Me.Balance > 0 Then
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE [Tbl_Payment] SET [Tbl_Payment].[Balance] = [Tbl_Payment].[Balance] +100 WHERE (((Tbl_Payment.Loanid)=forms!Frm_OutstandingBalances.loanid));")
DoCmd.SetWarnings True
Else
'Nothing
End If
Else (skip record)
End If
That would be nice but how would I do this?? Thank anyone in advance for their help!
P.S. - I also have a PaymentID field in tbl_Payment that's unique if we could somehow use that to say WHERE PaymentID = Updated Once or something like that.....
I have a little problem. So i'm working on a DB where it keeps track of loans and if a balance is still unpaid after 10 days then a late fee of $100 is added to it. The code in red below I have running on Open of the form and it works but obviously it updates EVERY time you open the form.
What I need it to do is update, but update only once per record. Basically:
If (Record hasn't been updated before) Then
If Me.[DateDue] < DateSerial(Year(Date), Month(Date), Day(Date) - 10) And Me.Balance > 0 Then
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE [Tbl_Payment] SET [Tbl_Payment].[Balance] = [Tbl_Payment].[Balance] +100 WHERE (((Tbl_Payment.Loanid)=forms!Frm_OutstandingBalances.loanid));")
DoCmd.SetWarnings True
Else
'Nothing
End If
Else (skip record)
End If
That would be nice but how would I do this?? Thank anyone in advance for their help!
P.S. - I also have a PaymentID field in tbl_Payment that's unique if we could somehow use that to say WHERE PaymentID = Updated Once or something like that.....