|
-
February 16th, 2000, 06:35 AM
#1
how to bound combobox ?
hello,
i am having difficulties in bounding a field to a combo box. i use ado to connect to the database and get what i want into a recordset.
then i set the recordset as the record source of the combo box but all i get in return is that it displays only the first record.
can someone help me to populate this combo box ?
-
February 16th, 2000, 04:48 PM
#2
Re: how to bound combobox ?
I haven't been able to bind a combo box to a recordset and have the combo box populate, I always have to do it manually. Ie...
Function FillComboBox(cboMain as ComboBox, rs as ADODB.Recordset, sFieldName as string) as Boolean
on error Goto ErrorHandler
While Not rs.EOF
cboMain.AddItem rs(sFieldName)
rs.MoveNext
Wend
FillComboBox = true
Exit Function
ErrorHandler:
MsgBox error
End Function
You can call this function and just pass it your combo box contro, the recordset and the name of the field to put into the combo box and it will do it for you.
Hope this helps,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
-
February 16th, 2000, 05:00 PM
#3
Re: how to bound combobox ?
thanks for the reply
by the way, that's actually what i do for the moment as i can't still find out how to do it automatically 
-
February 17th, 2000, 09:45 PM
#4
Re: how to bound combobox ?
I am not sure of prior versions of vb but with vb6 there is a datacombo control, simular to the combobox, that can be bound to the database.
d.paulson
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
|