can someone tell me how to accomplish this DataGrid/RecordSet update immediately after adding a new record.
My DataGrid doesn't show the newly added record unless I unload the Form containing the DataGrid and then reload it, then it shows the added record.
My setup is VB6 connected to an Access2K mdb Table via an Adodc. I have a DataGrid with its Datasource. I have an "Add New Record" data-entry Form for adding a new record, but when returning to the main DataGrid Form, the record doesn't show unless I unload the main DataGrid Form and reload it.
I've tried Update, Refresh and moving to a different record (I read somewhere that that action would add the new record to the DataGrid, but it didn't work.)
Here's my code:
Private Sub Command11_Click(Index As Integer)
Unload Accident_Reports_Database
Load Accident_Reports_Database
Accident_Reports_Database.Show
Unload Accident_Report_Add
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
End If
End Sub
Thanks for any suggestions in advance!
My DataGrid doesn't show the newly added record unless I unload the Form containing the DataGrid and then reload it, then it shows the added record.
My setup is VB6 connected to an Access2K mdb Table via an Adodc. I have a DataGrid with its Datasource. I have an "Add New Record" data-entry Form for adding a new record, but when returning to the main DataGrid Form, the record doesn't show unless I unload the main DataGrid Form and reload it.
I've tried Update, Refresh and moving to a different record (I read somewhere that that action would add the new record to the DataGrid, but it didn't work.)
Here's my code:
Private Sub Command11_Click(Index As Integer)
Unload Accident_Reports_Database
Load Accident_Reports_Database
Accident_Reports_Database.Show
Unload Accident_Report_Add
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
End If
End Sub
Thanks for any suggestions in advance!