PDA

Click to See Complete Forum and Search --> : Please help me ! ! ! ! !


Nov 23rd, 2000, 09:30 AM
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

davidrobin
Nov 23rd, 2000, 11:00 AM
You have to specify a cursor location, the 4th parameter for the recordset.open method.

it should be somehting like


myRecordset.Open "Categoria", myConnection, adOpenStatic, adUseClient, adCmdTable


Also you may need to refresh the data after setting the row source property.


Set DataList1.RowSource = myRecordset
DataList1.refresh


That should work.

Nov 24th, 2000, 05:12 PM
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.