I have an invoice table with a LastPaymentDate field. Payments are entered into InvoicePmt table from a NewPayments form. There can be multiple payments for an invoice. I am trying to update the LastPaymentDate field on the invoice with the date of the most recent payment. I thought I could do it with the OnClick event when saving a new payment, but I can't figure out how I would pass the date parameter. This is my code on the Save button:
Private Sub btnSavePmt_Click()
Dim strPmtDate As Date
strPmtDate = Me!PmtDate
On Error GoTo btnSavePmt_Click_Err
DoCmd.Close acForm, "frmNewPayment"
DoCmd.OpenForm "frmTPAGInvoice", acNormal
DoCmd.Requery
'Me!LastPaymentDate.SetFocus
'Me!LastPaymentDate.Value = strPmtDate
'End If
Obviously I have some major errors in this code. Any suggestions would be greatly appreciated.
Private Sub btnSavePmt_Click()
Dim strPmtDate As Date
strPmtDate = Me!PmtDate
On Error GoTo btnSavePmt_Click_Err
DoCmd.Close acForm, "frmNewPayment"
DoCmd.OpenForm "frmTPAGInvoice", acNormal
DoCmd.Requery
'Me!LastPaymentDate.SetFocus
'Me!LastPaymentDate.Value = strPmtDate
'End If
Obviously I have some major errors in this code. Any suggestions would be greatly appreciated.