Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go back to original record after Add is cancelled

Status
Not open for further replies.

gundie

Programmer
Feb 5, 2004
69
0
0
US
I have a datagrid on a form that's bound to a table(ID, Company, Contact). I've created two buttons, one for Add function (using .AddNew), one for Cancel (using .CancelEdit).

When I click the Add button, it shows a new record for add, no problem so far. During the Add function, when I click on the Cancel button, the new record disappeared, and the pointer goes to the last record in the datagrid.

Question: Is there a way to get the pointer to go back to the record that it was originally pointing to, not necessary at the last record, before I tried to add a new record?
 
Of of many ways is to create a "holder".
Code:
Dim LastRecord as Integer

'in the AddButton_Click
'Set LastRecord = DataGrid SelectedRow

'When the Cancel button is clicked
'Set the DataGrid selected row to LastRecord

 
I tried with Selectedrows, but it is read-only property. How do I set the row to be selected?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top