FILL COMBO WITHOUT dupes...

Reply

Join Date: Feb 2008
Posts: 20
Reputation: sal21 is an unknown quantity at this point 
Solved Threads: 0
sal21 sal21 is offline Offline
Newbie Poster

FILL COMBO WITHOUT dupes...

 
0
  #1
Jan 7th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: FILL COMBO WITHOUT dupes...

 
0
  #2
Jan 7th, 2009
Hi,
My suggestion
> Use ORDER BY Clause
> Iterate thru all records
> If duplicate occurs (If current = previous), simply ignores it
KSG
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: FILL COMBO WITHOUT dupes...

 
0
  #3
Jan 8th, 2009
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

  1. Dim str1 As String
  2. RS.MoveFirst
  3. List1.Clear
  4. Combo1.Clear
  5. Do While Not RS.EOF
  6. str1 = RS("MyField") & ""
  7. List1.Text = str1
  8. If List1.SelCount = 0 Then
  9. List1.AddItem str1
  10. Combo1.AddItem str1
  11. End If
  12. RS.MoveNext
  13. Loop

Regards
Veena
Last edited by QVeen72; Jan 8th, 2009 at 12:09 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC