|
-
Nov 4th, 2000, 03:07 PM
#1
Thread Starter
New Member
I have a combo box that pulls data from a database table and works fine.
My table looks like this:
field1 field2 field3
37 0.397 0.399 0.402
37 0.392 0.396 0.408
37 0.397 0.412 0.403
37 0.397 0.476 0.403
38 0.398 0.452 0.403
38 0.398 0.409 0.403
38 0.398 0.402 0.404
38 0.398 0.401 0.404
The problem is, I only want the combo box to display one instance of "field1". For example, I want 37 to be displayed only once, instead of twice, and 38 once, and so on...
THANX for any help on this!!!!
-
Nov 4th, 2000, 03:19 PM
#2
Fanatic Member
Sorry I do not have more information, but you might look at using the MSHFlexGrid Control. It allows you to connect to a database table and display the information the way you describe.
You will need to add the Microsoft Flexgrid Control to your project.
-
Jan 1st, 2001, 04:00 PM
#3
Why dont you add a distict word to you selection sql statement.
select distict colom1 from table...
where ...
-
Jan 1st, 2001, 06:15 PM
#4
Fanatic Member
I needed to do the same thing in an app I was working on recently and this is how I tackled it, the most important piece of this code is making sure sort the fields so they appear in order...
Code:
Dim sSQL as String
Dim rst as Recordset
Dim PrevItem
' Make sure items are displayed in order
sSQL = "SELECT field1 FROM Table ORDER BY field1 ASC;"
Set rst = DB.OpenRecordset(sSQL)
If not rst.RecordCount = 0 then
rst.MoveFirst
While Not rst.EOF
' Only add to combo box if the current item is different from the previous item
If Not rst!field1 = PrevItem then
Combo1.AddItem rst!field1
PrevItem = rst!field1
End if
rst.MoveNext
Wend
End if
rst.Close
set rst = Nothing
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|