Reputation: 7440
I have a very simple access db with two tables linked by a 1-M relationship with a Reference Integrity constraint. I would like to manage data by means of two forms. The first shows each single record of the first table and provides a button opening the second form which shows only those records haging the referenced field with the value of the first table recods primary key.
The problem is that if I tries to add a new record in the second form I am warned the record field I use as reference is not set with a value contained in the keys of the primary table. However I expected this was done automatically by the Form when I tried to add a new record?
How should I fix this?
Upvotes: 0
Views: 859
Reputation: 24207
If I understand correctly you are opening an independent second form (ie, not actually a subform) using some filtering criteria. One way to handle this would be to:
OpenArgs
argument of DoCmd.OpenForm
when opening the second formMe.HiddenKeyField.DefaultValue = Me.OpenArgs
)The other option is to make the second form a subform of the first. The easiest way to do that is to:
Upvotes: 2