E
Ed Havelaar
Hi,
Hope someone can help. Here's the scenario:
I have two MSAccess tables MainTab and SubTab. MainTab has an autonumber
'id' column as primary key. Subtab has this id column as a foreign key.
There is a one-to-many relationship defined on MainTab and Subtab using the
id column. The join type is include all from MainTab and only rows with
matching value from SubTab. Referential integrity enforced; cascading
updates and deletes.
I have a form MainForm based on MainTab. It has a subform based on SubTab.
Linked child and master fields are 'id'.
Open the form.
(a) Put some data into MainForm, and its id gets set to 1, and the default
value for new rows in the subform displays as 1, as desired.
(b) I press the |>* button to create a second new record in MainForm, but
don't put any data in it. The default value for id displays as
"(AutoNumber)". I go straight to the subform and enter some data. The id
field in the subform stays blank, presumably because the linked master row
doesn't exist. If I now go back to the MainForm and enter some data, the
new row in the subform disappears because its id value doesn't match the one
that now gets generated from the AutoNumber.
So my question is, is there any way to get insertion of a new row in the
subform to force generation of a matching row in the master MainForm, and
get the autonumber id from that MainForm back to the subform data?
- Ed.
Hope someone can help. Here's the scenario:
I have two MSAccess tables MainTab and SubTab. MainTab has an autonumber
'id' column as primary key. Subtab has this id column as a foreign key.
There is a one-to-many relationship defined on MainTab and Subtab using the
id column. The join type is include all from MainTab and only rows with
matching value from SubTab. Referential integrity enforced; cascading
updates and deletes.
I have a form MainForm based on MainTab. It has a subform based on SubTab.
Linked child and master fields are 'id'.
Open the form.
(a) Put some data into MainForm, and its id gets set to 1, and the default
value for new rows in the subform displays as 1, as desired.
(b) I press the |>* button to create a second new record in MainForm, but
don't put any data in it. The default value for id displays as
"(AutoNumber)". I go straight to the subform and enter some data. The id
field in the subform stays blank, presumably because the linked master row
doesn't exist. If I now go back to the MainForm and enter some data, the
new row in the subform disappears because its id value doesn't match the one
that now gets generated from the AutoNumber.
So my question is, is there any way to get insertion of a new row in the
subform to force generation of a matching row in the master MainForm, and
get the autonumber id from that MainForm back to the subform data?
- Ed.