943,954 Members | Top Members by Rank

Ad:
Jan 7th, 2009
0

FILL COMBO WITHOUT dupes...

Expand Post »
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sal21 is offline Offline
22 posts
since Feb 2008
Jan 7th, 2009
0

Re: FILL COMBO WITHOUT dupes...

Hi,
My suggestion
> Use ORDER BY Clause
> Iterate thru all records
> If duplicate occurs (If current = previous), simply ignores it
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Jan 8th, 2009
0

Re: FILL COMBO WITHOUT dupes...

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

vb Syntax (Toggle Plain Text)
  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.
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: MSHFlex Grid Field get Highlighted if it is current date
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: making macro in vb6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC