No duplicates in Combobox

H

hinterbichler

I have a combobox which takes the values from a different table.
Now in that table there are entries that are the same and show in the
combo box.
Is there a way to not show the duplicates (the duplicate entries make
the dropdown very large)

Chris
 
W

Wayne-I-M

Hi

Say you have a combo box that you have a list of people's name in. This is
based on a table (called tblTableName). In the table you have a field
called [1stName]

In the table and the combo box this is what you have

NameID Name
1 John
2 Sally
3 Jim
4 John
5 John
6 James
7 Phillip
8 Sally

As you can see you have all the names whiich includes 3 Johns and 2 Sallys.

Open your form in design view.
Select the combo - right click
Open the properties box
Select the data column
The row source Type should be = Table/Query
On the Row Source row click the build option (...)
This will open a blank query

At the top of the screen select the View tab and go to SQL and insert this

SELECT TableName.1stName
FROM TableName
GROUP BY TableName.1stName;

(Of course change this to the real name of your table and your field name)

Save and go back to your combo which should now have no duplicates

James
Jim
John
Phillip
Sally

Good luck with your project
 
H

hinterbichler

Hi Wayne

Thanks very much for that.
Works great.
As you can see I am very new to Databases.


Chris
 
W

Wayne-I-M

Hi

Top Tip - when posting to any public newsgroup - don't put your e mail
address on the post or you will get zillions of spam mails

Good luck with your new project
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top