How/when do forms & subforms relate?

E

Eric Johnson

I've noticed a difference in behavior of two form/subform combinations that
I'd love to be able to explain ...

Case 1:

I've got a form in which there's a subform. The data source for the form is
a table that has a one-to-many relationship with the table that's the data
source for the subform. The two tables relate on a field that the user
enters in the form, and when the user creates a new record in the form,
enters a new value in the relating field, and then creates a new record in
the subform, Access automatically fills in that relating value in the
relevant relating field in the new record in the subform. The relationship
between the two tables is defined in the relationship window.

Case 2:

Two tables relate as above (one-to-many). Again, there's a form (one) and a
subform (many), but the relating field is an AutoNumber field in the "One"
table and a Long Integer in the "Many" table. When a new record is created
in the form, the AutoNumber field is of course filled in with a new value.
When one goes to the subform to create a new record, though, this time
Access does not fill in the relating field with the value from the
AutoNumber field in the "One" table. As before, the relationship between
the two tables is defined in the relationship window.

No VBA code manages the user interface for these forms/subforms.

What factors control whether Access "fills in" the relating field for new
relating records automatically?

Many thanks if you have information to offer!

-- Eric Johnson
 
J

Jeff Boyce

Eric

In your main form, you have a control that "holds" the subform. That
(subform) control has properties, including Parent and Child properties.
Are you using these to keep the records in the subform "sync'd" with the
record in the main form?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top