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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post deleted data from one table to another

Status
Not open for further replies.

Joell

Technical User
Oct 4, 2002
10
AU
How do i post data that i've deleted from one table to another table for record purposes?
 
Well, you could use the add function.

Code:
var
  DelTable  Table
endvar

DelTable.attach(":PRIV:Deleted.db")

DelTable.add(":myAlias:myTable.db")

DelTable.unattach()


Of course that's simple code with no error trapping. You can check out the add() example in the help files for a more detailed code snippet.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Joell,

Mac's approach will work if you're using queries to delete records, however, if you're looking to track records deleted interactively, then you need to use some ObjectPAL code to capture and transfer the record before it's actually deleted from the table.

You can do this in two ways, depending on how you want to handle the final solution:

1. Capture and transfer each record as it's deleted.

2. Override the action that deletes records, set a flag instead of actually deleting the record, and then later use queries and other batch processes to transfer the data.

There are good arguments for either approach. Which are you looking to implement?

-- Lance
 
I was actually trying to do it using Delphi as my paradox tables are accessed through the BDE. I am probably looking at capturing and transferring each record to another table as it is deleted.

What I've got at the moment is deleting the current record:

procedure Tfrm_candidate_details.btnDeleteClick(Sender: TObject);
begin
TableForForm.Delete;
end;

Cheers,
Joell

 
Joell, you might be better off on the Delphi forum. I don't remember enough Delphi code to even guess. Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Joell,

You'll need to add code to the Dataset's BeforeDelete event.

Basically, you'll simply add a record to your backup table and then copy all existing field values to it.

That's all there is to it.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top