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
Rob Parker - 27 Apr 2005 09:31 GMT
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
> I have a combo box
>
[quoted text clipped - 10 lines]
>
> KennyKee
kennykee - 27 Apr 2005 09:42 GMT
You are totally correct
Thanks Very Much
> 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
[quoted text clipped - 20 lines]
> >
> > KennyKee
ETC - 29 Oct 2005 01:18 GMT
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
> 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
[quoted text clipped - 20 lines]
> >
> > KennyKee
Allan Murphy - 29 Oct 2005 08:46 GMT
Change DISTINCT to DISTINCTROW

Signature
Allan Murphy
Email: allanmurphy@unwired.com.au
> Hi Rob,
>
[quoted text clipped - 3 lines]
>
> My table (named "X Codes") has a field "Fac Loc". The column looks like
the
> following:
>
[quoted text clipped - 37 lines]
> > >
> > > KennyKee
ETC - 31 Oct 2005 20:51 GMT
It worked! Thanks, Allan.
> Change DISTINCT to DISTINCTROW
>
[quoted text clipped - 51 lines]
> > > >
> > > > KennyKee
Steve Schapel - 27 Apr 2005 09:36 GMT
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

Signature
Steve Schapel, Microsoft Access MVP
> I have a combo box
>
[quoted text clipped - 10 lines]
>
> KennyKee