Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to populate a multi column listbox with a ADO recordset I have
retrieved from Access, the code I have so far is adapted from the Microsoft site and works fine for a single column, but I cannot get the Age records to show, can anybody help? The code so far; Public Sub PopulateControl() Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim strSQL As String strSQL = "SELECT Name, Age FROM [table];" Set cnt = New ADODB.Connection With cnt ..Provider = "Microsoft.Jet.OLEDB.4.0" ..Properties("Data Source") = "F:\TESTADO.mdb" '.Properties("Jet OLEDB:Database Password") = "REDUNDANT" ..Open End With Set rst = New ADODB.Recordset With rst ..CursorType = adOpenKeyset ..LockType = adLockOptimistic ..Open strSQL, cnt End With ' Moves to the first record in the record set. rst.MoveFirst Do Until rst.EOF UserForm1.ListBox1.AddItem rst!Name rst.MoveNext Loop UserForm1.Show rst.Close cnt.Close End Sub thanks, Paul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Populating Column Headers in a ListBox | Excel Programming | |||
filling a two column listbox from a two column recordset | Excel Programming | |||
How to populate a multi-column activeX listbox on a spreadsheet with an ADO recordset | Excel Programming | |||
populating a multi-column Listbox | Excel Programming | |||
populating a multi-column Listbox | Excel Programming |