Re: Linked Form Not Allowing New Records
- From: "Rob" <rob.yergovich@xxxxxxxxx>
- Date: 15 Aug 2006 06:45:10 -0700
Hey Rick. Thanks for the advice. I didnt realize that about linked
forms. Its hard for me to describe what Im working on because I cant
talk about the data but I actually started with linked forms because I
have too many subforms to fit on one main form and be usable. Are
there any other options Im not thinking of as far as subforms? I want
to make this as user friendly as possible and the linked forms
definitly work better for what I have.
Rick Brandt wrote:
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: Rick Brandt
- Re: Linked Form Not Allowing New Records
- From: Jeff Boyce
- Re: Linked Form Not Allowing New Records
- References:
- Linked Form Not Allowing New Records
- From: Rob
- Re: Linked Form Not Allowing New Records
- From: Rick Brandt
- Linked Form Not Allowing New Records
- Prev by Date: Re: table update fails when memo field reaches 2 - 3K
- Next by Date: Re: Can't reference one subform from another.
- Previous by thread: Re: Linked Form Not Allowing New Records
- Next by thread: Re: Linked Form Not Allowing New Records
- Index(es):
Relevant Pages
|