This topic is locked

Saving Primary table form data before adding Secondary Table form data

4/11/2018 4:53:57 PM
ASPRunner.NET General questions
S
swiersman author

Hi All,
I have parent table called DEPLOYMENTCONSOLE and a child table called DETAIL.
They are joined together as follows - DEPLOYMENTCONSOLE/ID --> DETAIL/DeploymentID.
DETAIL/DeployentID is set up as a foreign key so that for each child record created the DETAIL/DeploymentID inherits the DEPLOYMENTCONSOLE/ID automatically incrementally assigned number by the DB.
THE PROBLEM:
When adding a new record through a form that contains both the DEPLOYMENTCONOSLE and DETAIL table fields, I go to save and get an error that it cannot insert a null into the DETAIL/DeploymentID field.
This makes sense since when adding a new record the DEPLOYMENTCONSOLE/ID # assigned by the DB will not be assigned until after the record is created.
Is there as way I can either:

  1. Get the next DEPLOYMENTCONSOLE/ID number from the DB when loading the add page.
  2. A way to be able to save the DEPLOYMENTCONSOLE form data to DEPLOYMENTCONSOLE DB first then continue to add the form data for the DETAIL table in the ADD page.(Since now the DEPLOYMENTCONSOLE/ID will be assigned.)
    I know I can input the DEPLOYMENTCONSOLE form data, Save and reopen and add the DETAIL form data in the Edit Page .I tried setting it up in the PAGES tab to Open in Edit Page after Add but is very clunky.
    Any help would be greatly appreciated,
    Scott

admin 4/12/2018

This sounds a bit confusing. Master-details and joined tables are two different things. Do not join tables if you need to link them as master-details.
You have an option to Add/Edit master and details together on the same page. Just do not join them.