No Repeat Please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box

But i dont want values in the list to be repeated eventhough the source has
same repeated value

eg source: "papaya", "banana", "apple", "papaya", "apple"

List i want to see is only "papaya", "banana", "apple" and not all.

Any Solution?

Thanks in adcance

KennyKee
 
If the recordsource for the combo-box is a value list, simply remove the
duplicates from the list. If the source is a table or query, include the
DISTINCT keyword in the SQL for the source; eg:
SELECT DISTINCT Fruit FROM tblFruit ...

HTH,

Rob
 
KennyKee,

Is the Row Source of your combobox based on a table? Instead, make a
query based on your table, and use this as the combobox's Row Source.
In design view of the query, right-click anywhere on the background of
the upper panel of the query design window, select Properties from the
pop-up menu, and then set the Unique Values property to Yes. The SQL
view of the query will look something like this...
SELECT DISTINCT Fruit FROM YourTable
 
You are totally correct
Thanks Very Much

Rob Parker said:
If the recordsource for the combo-box is a value list, simply remove the
duplicates from the list. If the source is a table or query, include the
DISTINCT keyword in the SQL for the source; eg:
SELECT DISTINCT Fruit FROM tblFruit ...

HTH,

Rob
 
Hi Rob,

I tried this too, but it didn't work for me.

Here’s my DB info…

My table (named “X Codesâ€) has a field “Fac Locâ€. The column looks like the
following:

Fac Loc
C
B
C
A
B

How do I create a combo box that lists each type of "Fac Loc" in Ascending
order without repeating ones that are listed multiple times? I tried using
DISTINCT, but I think I did the coding wrong. Please use the Field and table
names I've provided. I'm still a beginner and still trying to understand
coding. Any help is much appreciated. Thanks!

ETC
 
Back
Top