Admit have mymdb.mdb with table mytable and filed myfield in c:\...
Ho to fill combobox without dupes from table, please without "select distinct..." statement is possible?
Tks.

Recommended Answers

All 2 Replies

Hi,
My suggestion
> Use ORDER BY Clause
> Iterate thru all records
> If duplicate occurs (If current = previous), simply ignores it

Hi,

Try This :

Code is easy for ListBox..
If you want To Poulate a Combo Only, Then Place a ListBox on the Form and Set it's property Visible = False

Dim str1 As String
RS.MoveFirst
List1.Clear
Combo1.Clear
Do While Not RS.EOF
    str1 = RS("MyField") & ""
    List1.Text = str1
    If List1.SelCount = 0 Then
       List1.AddItem str1
       Combo1.AddItem str1
    End If
    RS.MoveNext
Loop

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.