Re: Linked Form Not Allowing New Records
- From: "Rick Brandt" <rickbrandt2@xxxxxxxxxxx>
- Date: Mon, 14 Aug 2006 22:00:03 GMT
Rob wrote:
I have a one to many relationship between two tables: tblCars and
tblParts (One car can have many parts). I created a form using the
wizard and chose "linked forms" instead of "form with subform" when
prompted. The problem Im having is that when entering new records in
the linked form it does not capure the "linked" field from the main
form which causes an error message which reads "Index or primary key
cannot contain a null value". I know access is supposed to "autofill"
that field but its not working. Whats more frustrating is that it
works fine for existing records. I only have a problem during data
entry. Any ideas?
No, Access is only supposed to autofill that field if you choose to build a
form with a subform. Linked forms do NOT provide that feature. All it does
is provide a filter for EXISTING records exactly as you are seeing.
You can solve the problem by setting the DefaultValue property of the second
form to a reference of the first form...
=Forms!FirstFormName!LinkingFieldName
That will mean that you can only use the second form when the first is open
and if you open the second form, navigate to a new record, and then navigate
to a different record on the first form before you fill out the new record
on the second form the new record will still have the linking field from the
record on the first form when it was originally opened. As you can see the
linked form is not as robust as a real subform in this regard. Code can be
added to both forms to solve some of these issues.
You can also make the second form modal so that you have to close it before
you can go back to the first form and change the record on that.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
.
- Follow-Ups:
- Re: Linked Form Not Allowing New Records
- From: Rob
- Re: Linked Form Not Allowing New Records
- References:
- Linked Form Not Allowing New Records
- From: Rob
- Linked Form Not Allowing New Records
- Prev by Date: Re: Linked Form Not Allowing New Records
- Next by Date: Re: Linked Form Not Allowing New Records
- Previous by thread: Re: Linked Form Not Allowing New Records
- Next by thread: Re: Linked Form Not Allowing New Records
- Index(es):
Relevant Pages
|