1
votes

I have a form with two subforms, one holds a clients details, the other the client's bookings, and this form compiles client details and bookings to make an invoice. Due to GDPR and my own sanity I am required to delete a clients details 4 years after their last booking, but they may have many invoices over a number of years. At the moment every time i create an invoice it updates a control on the client details subform to the last booking in that invoice (as below), is there a way to make it check which date comes last and keep that one? I've had a play with Iif but am just really struggling.

At the moment i have

Private Sub Booking_subform_Exit(Cancel As Integer)
    [booking contact subform].[Form]![latest booking].Value = [booking subform].[Form]![Max DATE]
End Sub
1

1 Answers

0
votes

If I understand you question correctly you want to find the last date of all invoices for a client, correct? Try to use DMAX function:

DMax ( expression, domain, [criteria] )

It is similar to DLookup but it returns the highest value.