How to group many records in Combo Box so just one appears?

bo8482

Registered User.
Local time
Today, 17:47
Joined
Feb 17, 2009
Messages
50
Dear all
I am a beginner who is beginning to lose patience with Access! I am positive this is a common problem but just can't find it in the forums or else am searching for the wrong thing.

I have a form that lists my client name and their orders below it. It is based on a query which pulls client details and orders together. I'm using a combo dropdown box so that users can select the client they want and then make any changes to the order if needs be.

The problems at the moment is that the combobox shows the same client name many times when dropped down. When you select the client, it goes to the last order (thanks to the MAX function in the date ordered field in the query) but I'd like it to just go to the last order and display only ONE client name in the drop down box.

If they need to cycle through to an earlier order they can use the navigation buttons but I'd prefer it to just show the latest and only one name in the drop down box.

Any ideas how to do this? If you could just point me in the right direction that wouuld be most helpful.
 
The query that you combo box is using should be grouped by client and Max(OrderDate)

Code:
SELECT ClientID, Clientname, Max(OrderDate) AS MaxOfOrderDate
FROM TblClients
GROUP BY ClientId, Clientname
ORDER BY Clientname;

Remember to use your table/field names

David
 
Thanks for the quick reply David. That works but for some reason I can't edit any of the details on my form. I've ensured that cascade-update is on, and the form isn't locked so I don't know why....any ideas?
 

Users who are viewing this thread

Back
Top Bottom