I have a row source that has the following sql:
Code:
SELECT t1.Name, t1.Address, t1.[Phone], t1.Email, t1.Office, t1.[SubDate]
FROM Primary AS t1
WHERE (((t1.Office)=[Forms]![frmInvoices]![cbo_Office]) AND ((t1.[SubDate])=(SELECT Max(t2.[SubDate]) FROM Primary t2 WHERE t2.Name=t1.Name GROUP BY t2.Name)));
User selects the name of the Office from a combobox. This value is passed to the record source SQL statement for the combobox cbo_Name.
The SQL and selects the name, address, phone, and email filtered by last date invoice submission occurred so I can be assured I have the most recent contact information for the Office selected.
From there I can select the Name from this pull down list or add new one.
Overall this works great except for the occasional record that has two invoice submissions on the same day. How can I rewrite this code to grab just one instance of this? I tried putting DISTINCT at the beginning of the statement but got even more multiple instances of the same name.
Again. Thanks in advance for any and all guidance.