Alpha Video Training
Results 1 to 10 of 10

Thread: UPDATE CHILD

  1. #1
    Peter Lear
    Guest

    Default UPDATE CHILD

    I have had a quick look in the archive to see if there is a quick answer.

    I have a set, with a parent and one child. One a one to one link. I have allowed cascade. But when I enter a new record in the parent, I do not see a new child. What i am doing wrong.

    Rev peter Lear - feeling silly

  2. #2
    Member
    Real Name
    robert adler
    Join Date
    Apr 2000
    Location
    Boynton Beach, BL
    Posts
    591

    Default RE: UPDATE CHILD

    Peter:

    Are you working from the set or from the individual files.
    you must work wiht the set. usually a screen show the fileds for the parent and the child. you enter data into the parent and move the cursor to a child field. the move to the child field will create the parent record. enter data into the child's fields and save the record.

    bob

  3. #3
    Peter Lear
    Guest

    Default RE: UPDATE CHILD

    Thanks Bob

    So I really have to type in name and initials and all that twice?
    Isn't there some way of posting the data. I am too inexperienced to try on my own without a shove in one direction. Peter

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: UPDATE CHILD

    If your form is based on the set, Alpha Five will enter the linking field values in the new child table record for you. You need merely enter something else into one of the other child table fields...

    In similar situations I often use a field rule in the child table to 'skip' the key field so the user cannot go back and edit a linking value after it's entered.

    -- tom

  5. #5
    Peter Lear
    Guest

    Default RE: UPDATE CHILD

    Thanks Tom

    I think I created the set AFTER I created the original entry form. I will re-create the main form in the set. The problem still arises that I will not always want to enter stuff into the the child when a new record is created. It may be at the second or third 'visit' that I shall need to do this.

    By then it is too late as the record will not have been created, or will an edit of existing record trigger the creation of the child?

    Peter

  6. #6
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default RE: UPDATE CHILD

    Hi Peter:

    Peter, to avoid junk in the child table and potential data entry problems in the set form, I would suggest that you design a small data entry form based on the child table. That form should NOT include the field that will link the parent and child.

    Open the set form in design mode and drag a sub-form object from the toolbar into the set form. Make this the approx. size of the form you designed for the child; choose "View a Child Table" and select the form you just created for the child. You won't see the form in design mode, just a box indicating its presence. Right click on that box, choose "Properties" and uncheck the tab stop box. This will stop the cursor from automatically going into the sub-form during data entry.

    Now, to enter a child record, you enter a value in the parent linking then click into the sub-form to enter a child record. You can do this either when a parent record is being entered or later, it makes no difference. The sub-form acts like any data entry form, if you realize that you don't want to add the child after all, hitting Escape will abort the entry and no child record will be created.

    Referential integrity applies to an existing parent-child relationship, it doesn't apply when entering a record. In your case, with ref. integ. set to cascade you could, later, change the value of the parent's linking key field and that change will "cascade" to the child, preserving the relationship between the two which would otherwise be broken. Likewise, if you delete the parent record, the child will also be deleted. This too can be problematic, if you have duplicate key values in the parent. Then, if you change the key value or delete one record you could have an unintended affect on another.

    I would pose the following questions for you to think about. Are you sure you really want a new child record entered EVERY time you create a parent record in your one to one set? If you really do, then it seems to me that you should at least consider the possibility that whatever fields you are putting in the child really belong in the parent table.

    Second, the value of the parent linking key can be problematic. If you are creating it "on the fly" make sure you have a field rule lookup defined to the child table so you can check if there is already a child record with that link ID. Then you can either create a different linking key in the parent or use the existing child record. Likewise you should probably enforce a field rule in the child that the linking ID field should have a unique value.

    Finian

  7. #7
    Member
    Real Name
    Paul Roesch
    Join Date
    Apr 2000
    Location
    Palm Beach County, FL
    Posts
    123

    Default RE: UPDATE CHILD

    Thanks to Peter for asking and Finian for the reply. This answers the problem I've been having to convert an A4V6 set to A5V4.

    Paul

  8. #8
    Peter Lear
    Guest

    Default RE: UPDATE CHILD

    Finian

    Thank you for this very helpful explanation. The need for every record to have a child is dictated by the fact that I cannot have a memo field on the parent without getting problems. Advice on this forum was to create a child for the memo fields - these are file notes which could be 30 characters or several hundred. So they have to be memos.

    Regards - Peter

  9. #9
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default RE: UPDATE CHILD

    I didn't connect one thread with the other ...

    The only addendum to my advice would be that, if you haven't already, add an id field to the parent record (make it Character, 6) and use an update to autopopulate the field with values beginning at 000001. There is a pre-defined genie that will create this update operation for you.

    Once each record has a unique ID, make the field autoincrement, and use it as the linking field to the memo table. This will eliminate at least one possible source of confusion between parent and child. Your sub-form can now be just one big memo field and you can be confident that each memo will link only to its correct parent.

    Finian

  10. #10
    Peter Lear
    Guest

    Default RE: UPDATE CHILD

    Finian - Thanks - this is not the first time you have saved my bacon. Peter

Similar Threads

  1. Update of Set Child with Parent fields
    By lgoode in forum Alpha Five Version 6
    Replies: 4
    Last Post: 06-23-2005, 02:29 PM
  2. Update child records
    By Mary Nickerson in forum Alpha Five Version 6
    Replies: 12
    Last Post: 02-09-2005, 12:49 PM
  3. update a child table
    By dik_coleman in forum Alpha Five Version 6
    Replies: 10
    Last Post: 10-09-2004, 03:45 PM
  4. update child records
    By geoff m in forum Alpha Five Version 5
    Replies: 3
    Last Post: 02-22-2004, 11:54 AM
  5. Update To Parent From Child
    By Thomas Holt in forum Alpha Five Version 4
    Replies: 3
    Last Post: 06-26-2003, 08:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •