Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

no duplicates

Status
Not open for further replies.

CompGirl

Technical User
Jun 2, 2003
40
SE
hi can anybody tell me what i am supposed to do if I dont want duplicates in my combo box. I dont want it to write the number twice when its already there...

thx
 
When you build the combo box through the query builder. Click on the frame which the tables are added to and right click, select properties, select unique values.

Let me know if that works.

David Pimental
(US, Oh)
dpimental@checkfree.com
 
What is showing up in your combobox is controlled by the RowSource property. More than likely this is a table, query, or SQL code. A query that aggregates the multiple instances of the field in question down to just one can be done. Please post the SQL. If the RowSource is a table then post the tablename and the fields necessary for the combobox and we will provide the SQL so that you will only have one instance.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
this is what is said in the row source:
SELECT [Property].[ID], [Property].[Property_Severity_Class] FROM Property;

so right now it shows something like:
IV
IV
III
II

it reads of course from a table so i guess it takes all the different types... now... how can i stop the duplicates besides from breaking the numbers to a single table.
 
Click the build button (i.e., "..."), it will open the QBG window. This allows you to graphically build a query.

This window is divided into 2 parts. Right Click on the upper pane, and select properties.

Change the Unique Values to Yes.

Let me know if that does it.

David Pimental
(US, Oh)
dpimental@checkfree.com
 
hi.. im sorry but i dont understand where im supposed to set that property since i cant find the properties...

This window is divided into 2 parts. Right Click on the upper pane, and select properties.

- i know the build window but where is the properties
 
With the form in design mode, right click the combo box and select properties.

To the right of the RowSource property click on the button with the 3 periods (...).

The Query Builder should pop up.

Your field list will be on the bottom pane and the table or query will be on the top pane.

Right Click on the top pane of the query builder and select properties.

Then change the Unique Values from No to Yes.



David Pimental
(US, Oh)
dpimental@checkfree.com
 
hmmm okej did that but it didnt work.. it still shows everything :/

thx anyway
 
Is the source of the combobox based on 1 table or query or more than one?

David Pimental
(US, Oh)
dpimental@checkfree.com
 
the combobox is based on one table with several fields
 
for example

sweden stockholm
sweden norrköping
germany hamburg
denmark kopenhagen

this is the thing... i dont want two swedens to be shown in the combo box just because the country appears two times in the table... hope ive explained better this time :)
 
Why don't paste the sql to this forum.

Is there a reason why you need both fields.
You could have just the country selected, and select distinctrow to get no duplicates.

Then you could have another combo box for the cities based on the query for the countries.

Let me know.

David Pimental
(US, Oh)
dpimental@checkfree.com
 
the thing is.. if i did this after what i wanted i would create a table just for countries... but the thing is.. the person that asked me to do this want the information on one table.. thats why the country appears more than once...

SELECT DISTINCT Environment.ID, Environment.Environment_Severity_Class
FROM Environment
ORDER BY Environment.Environment_Severity_Class;

this is the SQL behind the combo box
 
If this is your SQL the reason you have more than one record for ID is that there is more than one Environment_Severity_Class value for the multiple instances of ID. If you want ID to be Distinct then eliminate the second field.

SELECT DISTINCT Environment.ID
FROM Environment
ORDER BY Environment.ID;



Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
You can keep the information all in one table, without using it all in the combo box.

Here is my assessment (and questions).

In the table there are 2 fields.
Field1 = Country
Field2 = City

Now the source of the combo box is using both fields.
But does it have to?

Also, when you right click on the combo box and select properties, under the RowSource, is there a table name or a sql statement?

David Pimental
(US, Oh)
dpimental@checkfree.com
 
SELECT DISTINCT Environment.ID
FROM Environment
ORDER BY Environment.ID;

if i only use this it doesnt show anything

dpimental:

no i guess that it doesnt have to use both fields... but when i did what scriverb said it didnt show anything
 
There are check boxes below each field that says "show".

See if it's clicked?

David Pimental
(US, Oh)
dpimental@checkfree.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top