Combo Box with only unique values

gheyman

Well-known Member
I have a combo box on a form. It is based off a query

SELECT [qry_vluVendorAddress].[VendorName], [qry_vluVendorAddress].[VendorID], [qry_vluVendorAddress].[CityName], [qry_vluVendorAddress].[MailState], [qry_vluVendorAddress].[CountryCode] FROM qry_vluVendorAddress ORDER BY [VendorName];

How do I get the Combo Box to not show Duplicates?

Not the query I listed above was created just for the Combo box list (based on two tables). So I can do what ever is needed to get a list that only has unique records

Thanks
 

Joe4

MrExcel MVP, Junior Admin
Re: Access: Combo Box with only unique values

One way is to group the records via an Aggregate Query.
You do this by grouping by all the fields in your Select clausei.e.
Code:
[COLOR=#333333]SELECT [qry_vluVendorAddress].[VendorName], [qry_vluVendorAddress].[VendorID], [qry_vluVendorAddress].[CityName], [qry_vluVendorAddress].[MailState], [qry_vluVendorAddress].[CountryCode] 
FROM qry_vluVendorAddress 
[/COLOR][COLOR=#ff0000]GROUP BY [qry_vluVendorAddress].[VendorName], [qry_vluVendorAddress].[VendorID], [qry_vluVendorAddress].[CityName], [qry_vluVendorAddress].[MailState], [qry_vluVendorAddress].[CountryCode] [/COLOR][COLOR=#333333]
ORDER BY [VendorName];[/COLOR]
Another alternative can be found here: https://support.office.com/en-us/article/all-distinct-distinctrow-top-predicates-24f2a47d-a803-4c7c-8e81-756fe298ce57
 
Last edited:

Some videos you may like

This Week's Hot Topics

Top