Hi everyone!
I'm desingning a database app... and need to fill a datagrid on runtime. I've checked some other post and the solution they propose are using:

Set datagrid1.DataSource = rs

But when i start the program the datagrid doesn't fill... i have put some textbox with references to the recordset to check that it's working and that was ok... the only problem is the datagrid not filling up...

this is the code i'm using:
Dim cn As New ADODB.Connection
Dim record As New ADODB.Recordset
Dim record2 As New ADODB.Recordset

Private Sub cmdsalir_Click()
Unload Me
End Sub

Private Sub Form_Load()
Set record = New ADODB.Recordset
Set record2 = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\ExplosionMat\explosion.mdb"

record.Source = "entrada_mt"
record.CursorType = adOpenKeyset
record.LockType = adLockOptimistic
record.Open "SELECT * FROM entrada_mt", cn
record.MoveFirst

record2.Source = "catalogo_mt"
record2.CursorType = adOpenKeyset
record2.LockType = adLockOptimistic
record2.Open "SELECT * FROM catalogo_mt", cn
record2.MoveFirst

txtdatos(0).Text = record.Fields("clave")
txtdatos(3).Text = record.Fields("proveedor")
txtdatos(4).Text = record.Fields("orden_comp")
txtdatos(5).Text = record.Fields("fecha_fact")
txtdatos(6).Text = record.Fields("fecha_ent")

Set dgentrada_mt.DataSource = record
End Sub

Can someone help please! thanks!

Record.CursorLocation = adUseClient
Record.Open "....."

Record2.CursorLocation = adUsedClient
Record2.Open "...."

Problem solved... thanks to both of your comments it's working now.
I'm realy grateful!!!

This question has already been answered. Start a new discussion instead.