Here is a sample of populating a listbox.
Private Sub Form_Load()
Dim myDB As Database
Dim sPath As String
Dim myRS As Recordset
sPath = "k:\working\TestCode.mdb"
Set myDB = OpenDatabase(sPath)
Set myRS = myDB.OpenRecordset("tnl1")
Do While Not myRS.EOF
List1.AddItem myRS(2)
myRS.MoveNext
Loop
End Sub
This was using DAO 3.5 and Access 97. Make sure that the reference to
the DAO 3.5 library is selected in your project references list.
Sol.
Quote:
>CAn anybody help me?
>I have been trying for days to figure out the proper way to use list boxes
>and combo boxes, in VB6
>The scenario is that I want to use them in forms to furnish lookup data from
>lookup tables, to feed into a master table, to increase data reliability; a
>common enough problem.
>It seems pretty simple to do this using DBlist andDBcombo controls which
>come with VB6, but these seem to need to have their data supplied by a data
>control.
>Can somebody show me either
> -how to bind the DBList & DBCombo directly to a pair of recordsets, or
>- how to bind the listbox & combobox to a pair of recordsets so that I can
>feed lookup data from one to the other
>Thanks