I am running my [rptInvoiceBalDue]. (currently running very nicely) I will run this monthly!
Before I do this, I need to update all the member's Balance Due if the members renewal date has passed, so I am invoicing the correct amount.
I am setting up the VBA code (on Load) to search [tblMember].
I've never done a entire table search, only coded from an open form...So I am not sure how to assign items from or to a specific member ID when I don't have a Me! to take values from. I don't know if there is a better way or another approach but... I am trying to learn correctly.
So,
I need it to find each record where today's date is equal or Greater then the [RenewalDate]
add the value of [TotalDues] to [tblTransaction]![Debit];
Assign Date() to [tblTransaction]![TransDate];
Assign [tblMember]![ID] to [tblTransaction]![MemberID];
Assign the value (5) to [tblPaymentInfo]![PaymentMethod]
I already have a form [frmTransactionInput] I use that has all the fields I need to complete all these tasks.
The code I am thinking is: (I am not sure of code with * before it)
Private Sub
Dim CRD As Date 'Current Renewal Date
Dim dblTotalDues As Double
* dblTotalDues = DLookup("TotalDues", "tblMember) ' ", "ID = " & tblMember!ID) How do I deal with the MemberID?
* CRD = DLookup("RenewalDate", "tblMember) ' ", "ID = " & tblMember!ID)
If Date >= CRD Then
DoCmd.OpenForm ("frmTransactionInput") "can this can be done Non-Visable
* Me!MemberID = 'ID from tblMember, do I need to DIM this value???
Me!TransDate = Date()
Me!Debit = dblTotalDues
Me!PaymentMethodID = 5
DoCmd.close
* tlbMember!RenewalDate = DateAdd("yyyy", 1, CRD) 'Increases Members Renewal Date by one year
End If
DoCmd.Requery ("qryTransactionBalance") 'I get my Invoice report's balance values from here.
End Sub