Hi,
I'm making an application in VB6 and a database in SQL SERVER.
I'm triyng to populate a dbcombo with code, without data controls.
With property datasource, no problem. But how can I do with rowsource?
Thanks in advance for any tip.
I think I know what you mean as Itoo have had to populate many combos without the use of data controls, however I only used simple bog tsandard combos. The code was something like
devBoundControls.tblTable
20 With devBoundControls.rstblTable
30 If Not .EOF Then
40 cboName.Text = .Fields("FieldID"
50 End If
60 While Not .EOF
70 cboName.AddItem .Fields("FieldID"
80 devBoundControls.rstblTable.MoveNext
90 Wend
100 End With
110 devBoundControls.rstblTable.Close
This got a recordset froma data environment and then looped and populated the combo
I hope the linenumbers were just a joke. :-D
Also in your example, If the user selected the drop down list type of combo, you will need to populate the list before you set the text otherwise a error will occur.
devBoundControls.tblTable
With devBoundControls.rstblTable
While Not .EOF
cboName.AddItem .Fields("FieldID"
devBoundControls.rstblTable.MoveNext
Wend
.movefirst
cboName.Text = .Fields("FieldID"
End With
devBoundControls.rstblTable.Close
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.