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!

DataGrid1.ReBind ???

Good Luck

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!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.