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

Data wont delete from database

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
Ok i have a form with a sub form. when running my appliuation I have a Id field that links the two. when i delete the main record it removes both but if you try to put another in with same id unique index error. when looking into the database it shows the records are still therer and you have to go up and do the remove deleted records. after doing this i am fine. How do i skip this procedure
 
The purpose behind unique indexes is to prevent what you are trying. If you don't want to assign a new id number, you could try this:

1] Set deleted off

2] Use INDEXSEEK (with a move pointer) to see if the record already exists.

3] If FOUND(), check to see if DELETED() (because you don't want to overwrite good data with bad). If NOT FOUND(), just add a new record.

4] If DELETED(), issue a RECALL and the replace all of the original values with the new values. If NOT DELETED(), then you've got a potential data conflict you'll have to deal with.

IMHO, it's easier to just assign a new id and let the deleted records alone.

Steve



 
HI
I am not clearly understanding what you convey...
1. If your deleting the Master file record does not delete the child records... it is true.... you have to delete in both the place..
When you DELETE the master DBF record.. SELECT childDBF and then delete all records where id=master_id.. select back master file.

2. If you are meaning that you are not able to add even after master/child record deletions.... may be you are using a primary key. SO you need to drop the records totally with a pack comand and then add the record with same ids. An alternative is to recall that master record, when same id is used... and then blank out all other field contents.

Hope this helps.
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top