Re: Linked Form Not Allowing New Records



Rob

Consider using a tab control and putting a subform on each tab.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Rob" <rob.yergovich@xxxxxxxxx> wrote in message
news:1155649510.233919.236780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • RE: open same record but new form
    ... LinkMasterFields and LinkChildFields properties of each subform? ... > technology are on a subform on the first form. ... I need the second form to display the first three fields acording to ...
    (microsoft.public.access.forms)
  • Share one Qry for 2 Forms for two way data entry not all fileds
    ... fields from one table (designorders). ... The second form contains some of the ... Reqnum is my child/master link for the main and subform also. ... some reason the linked tables want to be populated in the first form even ...
    (microsoft.public.access.forms)
  • Re: Linked Form Not Allowing New Records
    ... Consider using a tab control and putting a subform on each tab. ... That will mean that you can only use the second form when the first is ... record on the first form when it was originally opened. ... Rick Brandt, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • RE: Cant add new record to form
    ... you might try playing with a subform command tool. ... items (a breakdown of one of the cost totals) from the Main Data. ... then I created the second form and used a command ...
    (microsoft.public.access.forms)
  • Re: passing values between forms
    ... Some times it says that the form does not exists or that control does not ... to a subform within a subform on the first form ... the second form to the first one. ... My first form is frm_BasicData_BasicData, ...
    (microsoft.public.access.formscoding)

Loading