I have an ADOTable that contains 3,200 records of individuals that includes e-mail addresses. Only about half have valid e-mail addresses. I have a routine that deletes invalid e-mail addresses. It works. I search for the record that contains the Email that I want to delete. I do a cell click to extract the E-mail address that I want to delete. I the execute the following code to delete the selected E-mail:
procedure TForm_Listing.Button_DeleteClick(Sender: TObject);
begin
Form_Listing.ADOTable1.Edit;
Form_Listing.ADOTable1.FieldByName('Email').AsString := '';
Form_Listing.ADOTable1.Post;
end;
end;
The E-mail is deleted but the cursor jumps to another record. I need to keep the original record selected because I have another routine that reverses the process and replaces the deleted E-mail in in case I made a mistake. This routine is:
procedure TForm_Listing.Button_ReverseClick(Sender: TObject);
begin
Form_Listing.ADOTable1.Edit;
Form_Listing.ADOTable1.FieldByName('Email').AsString := Email;
Form_Listing.ADOTable1.Post;
end;
Since now a different record is selected, the E-mail address is entered in the new record.
How can I insure that the originally selected record remains selected after the successfully delete?
procedure TForm_Listing.Button_DeleteClick(Sender: TObject);
begin
Form_Listing.ADOTable1.Edit;
Form_Listing.ADOTable1.FieldByName('Email').AsString := '';
Form_Listing.ADOTable1.Post;
end;
end;
The E-mail is deleted but the cursor jumps to another record. I need to keep the original record selected because I have another routine that reverses the process and replaces the deleted E-mail in in case I made a mistake. This routine is:
procedure TForm_Listing.Button_ReverseClick(Sender: TObject);
begin
Form_Listing.ADOTable1.Edit;
Form_Listing.ADOTable1.FieldByName('Email').AsString := Email;
Form_Listing.ADOTable1.Post;
end;
Since now a different record is selected, the E-mail address is entered in the new record.
How can I insure that the originally selected record remains selected after the successfully delete?