|
-
May 14th, 2000, 11:52 PM
#1
Thread Starter
New Member
Is it possible to have multiple columns in a combo box? Any help would be great. thanks in advance
-
May 15th, 2000, 02:37 PM
#2
Hyperactive Member
Hello dionj,
Here is a part of a source to fill a combobox with information from two fields from a database, delimitted by "|"
Private Sub Form_Load()
DbSetting = "f:\BB.mdb"
Set DB = OpenDatabase(DbSetting)
Set RS = DB.OpenRecordset("select * from YourTable")
LenName = 0
LenFirstName = 0
RS.MoveFirst
While Not RS.EOF 'searching for the longest string
If Len(RS("Name")) > LenName Then LenName = Len(RS("Name"))
If Len(RS("FirstName")) > LenFirstName Then LenFirstName = Len(RS("FirstName"))
RS.MoveNext
Wend
RS.MoveFirst
While Not RS.EOF
Combo1.AddItem Left(RS("Name") + Space(LenName + 2), (LenName + 2)) & "| " & RS("FirstName") + Space(LenFirstName + 2)
RS.MoveNext
Wend
Combo1.Text = Combo1.List(0)
End Sub
IMPORTANT: THIS WILL ONLY GOES WELL IF ALL CHARACTERS OF THE COMBO TEXTSTYLE DO HAVE THE SAME DISTANCE! (PROPORTIONAL)
Michelle.
-
May 16th, 2000, 07:54 PM
#3
Thread Starter
New Member
Thanks for the idea, but I was hoping on being able to do it without having to pad the columns with spaces, and besides the informatin for the combo box is coming form a database with over 10,000 records so finding the longest and padding the other records would be inefficient
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
|