-
Why the following code don't work; the datalist is always empty. The recordset have 80 records.
Option Explicit
Dim myConnection As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Private Sub Form_Load()
Set myConnection = New ADODB.Connection
Set myRecordset = New ADODB.Recordset
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\S\Recetas\Cocina2000.mdb;"
myConnection.Open
myRecordset.Open "Categoria", myConnection, adOpenStatic, , adCmdTable
DataList1.BoundColumn = myRecordset!cat_receta
DataList1.ListField = myRecordset!cat_descri
Set DataList1.RowSource = myRecordset
End Sub
TIA
-
You have to specify a cursor location, the 4th parameter for the recordset.open method.
it should be somehting like
Code:
myRecordset.Open "Categoria", myConnection, adOpenStatic, adUseClient, adCmdTable
Also you may need to refresh the data after setting the row source property.
Code:
Set DataList1.RowSource = myRecordset
DataList1.refresh
That should work.
-
i have the solution
in another forum MAKAI give to me the solution
DataList1.BoundColumn = "cat_receta"
DataList1.ListField = "cat_descri"
Set DataList1.RowSource = myRecordset
now the datalist1 works fine.