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

How do I delete a record after using it? 2

Status
Not open for further replies.

maggielady

Technical User
Jan 3, 2003
60
US
I have a program that takes the entries out of one db and puts them into another based on a certain criteria. Once the record meets that criteria it's moved to the second db but then I want to delete that entry that was moved out of the first db. Not sure how to accomplish this. Any help would be greatly appreciated!!
 
DELETE <- marks record that pointer is on for deletion
PACK <-Removes deleted records from talbe in current work area


...there is some argument to be made for not packing out deleted records (though I don't entirely buy it), some will just SET DELETED ON and work around the deleted records...I guess it is safer, but in the scenario you described I would pack them out of the table(s) once you've ascertained that the records were indeed moved.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
HI

SET DELETED ON

Select SourceDB
SCAN for conditions..
SCATTER MEMVAR MEMO
INSERT INTO destinationDB FROM MEMVAR
DELETE IN SourceDB
ENDSCAN

If you want to PACK, make sure that you are opening the table in EXCLUSIVE mode.

:)

ramani :)
(Subramanian.G)
 
To save file space, after deleting a record you can always recycle it. Instead of doing APPEND all the time, use something like:

SET DELETED OFF
LOCATE FOR DELETED() && or SEEK() if there's an index
IF FOUND()
BLANK
RECALL
ELSE
APPEND BLANK
ENDIF
REPLACE ... WITH ...
.
.
SET DELETED ON

That way you won't have to PACK all the time.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top