There are those times when it would be helpful to clone an existing record in a table. With a few lines of code this is easily accomplished.
Establish a control to initiate the cloning action. I accomplished this by leveraging a menu item.
Within the menu item the following code will invoke the cloning mechanism.
procedure TBCSSslC.CloneARecord1Click(Sender: TObject); begin BCSSsldm.atassr.InsertRecord([nil, BCSSsldm.atassrpoc.AsString, BCSSsldm.atassraddr.AsString, BCSSsldm.atassrreq1.AsString, BCSssldm.atassrdwa1.AsString]); end;
The InsertRecord command works nicely for cloning the currently active record in a quick and dirty manner.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.