natali
natali

Reputation: 5

view unique values in Combobox using VBA in MS Access

please read my question to end because I test all previous solutions in Stackoverflow and have no answer. I am trying to display Combobox in the form of an MS Access database using VBA, this Combobox takes its values from one table the problem that I can't display just unique values, Combobox views all values even when I use DISTINCT still view all. also, I am trying to use GROUP BY but not work. I know it is a simple problem but how can I solve it?

SELECT DISTINCT Exports_imports_Table.ID, Exports_imports_Table.content FROM Exports_imports_Table;

Upvotes: 0

Views: 469

Answers (2)

Bharat Khatri
Bharat Khatri

Reputation: 1

Don't take the ID field in your query builder. Instead of that, select the same field twice, leaving one of them as is, and in another you can give your conditions or formats (if any).

Make sure to change unique values in general properties to "yes".

Save it, and there you are.

Upvotes: 0

braX
braX

Reputation: 11755

Assuming the ID field is a unique value (and the content field may have duplicates) you cannot include it in a DISTINCT. Try it like this

SELECT DISTINCT Exports_imports_Table.content FROM Exports_imports_Table;

Does that give you what you expect?

Upvotes: 1

Related Questions