By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

How do I use to combo box in a form to display desired values?

P: 1
Hello..
I have a table with a field name called 'Professions'. There are many same multiple values for this field, for example, there are many records with the value 'Doctor' under this field.

Here are the values under this field in the table:
Lawyer
Lawyer
Teacher Scientist
Doctor
Engineer
Doctor
Doctor
Mechanic
I want to make a form with a combo box where the combo box shows values under 'Professions', but I do not want the value 'Doctor' to be repeated more than once in the combo box... How can I do this??

I have already tried creating a combo box query, but then the value 'Doctor' gets repeated more than once in the combo box because of the many records...

When I open the combo box, I get these values:
Lawyer
Lawyer
Teacher Scientist
Doctor
Engineer
Doctor
Doctor
Mechanic
but what i want to get after opening the combo box is:
Lawyer
Teacher Scientist
Doctor
Engineer
Mechanic
How do I do this? I hope I've made myself clear...
Feb 15 '08 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 2.5K+
P: 2,545
Hello..
I have a table with a field name called 'Professions'. There are many same multiple values for this field, for example, there are many records with the value 'Doctor' under this field.

I want to make a form with a combo box where the combo box shows values under 'Professions', but I do not want the value 'Doctor' to be repeated more than once in the combo box... How can I do this??
Hi. In the rowsource property for the combo change the existing table reference or query to read like this, where [your table name] is the real name of the table or query holding the professions field:

Expand|Select|Wrap|Line Numbers
  1. SELECT [your table name].[professions] FROM [your table name]GROUP BY [your table name].[professions] ORDER BY [your table name].[professions];
  2.  
If you used the Access wizard for creating the combo box you could achieve the same thing by editing the rowsource property after the wizard created it. From the graphical query editor by selecting View, Totals (which does the Group By bit) and selecting Ascending in the order row.

Cheers

Stewart
Feb 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.