Re: Select Distinct To Populate Combo Box
Ok, I'll try to explain a little more. The example I provide is only for 1 combobox, but you can use this for the other as well.
The global thing that I do is, before I add a new element in the combobox I check if the item I want to add already exists in the combobox. If the item is founded in the combobox I don't add the item. If the Item isn't found in the combobox I add the item.
'Here you loop the combobox:
'Start to search the combobox from item 0 until last item
For intcounter = 0 To txtStocksearch.listcount-1
'Check if item is equal to current record-item from the recordset
'If the item is equal we exit the loop because we found the item
If frmAgent.txtStockSearch.list(intcounter) = rsComb!STOCK Then exit For
'Correction < should be =
'If our counter is equal to the total items in our box we have looped the box without finding the item => so we add the item
If intcounter [COLOR="Red"]=[/COLOR] txtStocksearch.listcount Then frmAgent.txtStockSearch.AddItem rsComb
I hope this helps you to understand what the code actually does: checking before adding the item, if the item is in the combobox.