-
Dear All
I have a combo box on a form that is populated by fields from a recordset. There are some duplicate values in the recordset but I only want to display one instance of it in the combo box.
I have got round by the example in the code but was wondering if anyone knows another way maybe easier\quicker.
Code:
Dim sLastItem As String
Do Until rstTemp.EOF
If Not sLastItem = rstTemp![Result] Then
combo1.AddItem rstTemp![Result]
sLastItem = rstTemp![Result]
rstTemp.MoveNext
Else
rstTemp.MoveNext
End If
Loop
-
You need to use the DISTINCT SQL command;
eg;
SELECT DISTINCT name FROM authors
will only return one of each name... (assuming that some names are the same in the table)
-
Thanks Buzby
That works a lot better