Opening individual record by clicking on Datagrid
Posted on 2003-11-02
Using VS6 SP5, Ado , Win2K and Access 2K.
Have a datagrid returning records, wanted to double click on individual record
and it open in its own form for editing purposes. Vinnyd179 provided the code below which works great, however when I change a control's value and
close with Adodc1.Recordset.Update, it doesn't update the record. I assume
the code below only populates the controls and doesnot allow editing...
Can anyone explain to me how to make this form update the current record that is being displayed,( I assume that the record isn't actually opened and that the values that have changed actually need to be inserted back into the Access DB, But I just don't know how to open that exact individual record and append the updates.....
use the double click event of the grid:
' assumes rs is a public recordset
Private Sub DataGrid1_DblClick()
' clear boxes
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
' populate Textboxes from rs recordset
Form2.Text1 = .Fields("Field1").Value
Form2.Text2 = .Fields("Field2").Value
Form2.Text3 = .Fields("Field3").Value