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

Copy a record

Status
Not open for further replies.

AlanBreck1000

Programmer
Oct 20, 2005
28
US
I have an application that when a user makes the record inactive by selecting a radio box on the update form i.e. 'Active' 'Inactive' radio options I would like it to copy certain fields in that particular record to a child related database, any help please.
 
Assuming that the Parent & Child are related by ID in the Parent file and ParentID in the Child database with a key called ParentIDKey KEY(ParentID,..) in the child database :

In ABC - WindowManager - INIT - After opening tables

LOC:Status = PARENT:Status ! store the original value of the Active/Inactive

In ABC - Take Completed - After Parent Call

IF NOT ReturnValue ! check if file action on parent file was sucessful
IF SELF.Request = ChangeRecord AND PARENT:Status <> LOC:Status
CLEAR(CHILD:Record)
CHILD:parentID = PARENT:ID
SET(CHILD:parentIDKey,CHILD:parentIDKey)
LOOP UNTIL Access:pARENTFILE.Next()
IF CHILD:parentID <> PARENT:ID THEN BREAK.

<update child fields based on Status changed>

Access:CHILDFile.Update() or Relate:CHILDFile.Update()
END
END
END

HTH-Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top