I haven't done this before, but looking at the Developer's Guide, you can add the 5 child records by setting the DocItem's AutoNewOnParentAdded property to False, then putting code in the DocItem's HookParentAdded() method. You also have to register DocItem as a child business object of DocHead in the form's constructor in order for the HookParentMethod() to be called.
>Hi All,
>
>I'm new to MM and am trying to add some child records in code within a business object each time a new parent record is created. As I create the child records, I'd like to be able to make use of all the MM capabilities (business rule testing, error trapping, primary key / foreign key handling, etc.) and would appreciate a "best practices" recommendation for how to do this within MM.
>
>I have two tables (at this point managed by two business objects): DocHead (parent) and DocItem (child). These both have autoincrement PKs (DocHeadID and DocItemPK) and they should always have a one-to-many relationship based on DocHead.DocHeadID = DocItem.DocHeadID.
>
>Each time the user creates a new DocHead record, I'd like it's business object to also create 5 related DocItem records and return all of these new records to the form for editing.
>
>Thanks in advance,
Chris McCandless
Red Sky Software