Access forms and subforms

O

Oden1988

I have a database that uses a main form with 6 subforms in it. In each of
the subforms, I can enter multiple lines of data for each main form record.
However, when I select a new record on the main form, the data in the
subforms (which is linked to the data in the main form) does not change to
new subforms. Basically, I have a name in the main form and each subform
contains different information related to that name. Each subform can
contain multiple entries like phone numbers (a land line, cell, and work
number) all associated with the one name. The other subforms contain
different pieces of info, but all are linked to the name. When I am finished
entering all data in all subforms, I need to be able to switch to a new
record set (new name) and all the subforms need to change as well. AS of
right now, this is not happening. The main form (with the name) will change
, but all subforms do not and what happens is all the data in the subforms
from person 1 is now linked to person 2 as well. How do I get a "fresh" set
of forms to enter new data for another person?

Thanks for any help.
 
K

Klatuu

Sounds like you are not linking your subform data to your main form correctly.

In each subform control (not the form being used as a subform, but the
subform control) on you main form, there are two properties. Link Child
Fields and Link Master Fields. These two properties keep the form and
subforms in sync.
In the Link Child Fields property, put the name of the field in the
subform's recordset that relates to the main form's recordset. In the Link
Master Fields, put the name of the field in the main form's recordset that
relates to the sub form's recordset.
 
O

Oden1988

Ok, so in my situation, since the "name" field in the main form is the key to
all, would that be the "Link Master Field" then? And do I do this link
function for each subform (which are all on different tabs)? Basically for
the "child" field, it would be the "Primary Key" field in each subform table
(such as phone number or email address)? Will doing this still allow for
multiple entries?

Thanks again.
 
A

Albert D. Kallal

You might try using the wizard to add the sub form to a your form, and it'll
prompt you for the master, and linked child fields.

Your child table(s) will look like:


id: primary key (type:autonumber), this likely not to be used at this
point in time
main_id foreign key (type: long number) - this is the link child
field.
PhoneNumer (type text)
etc. etc.

To "link" the above table to the "main" form, you need to set main_id (or
whatever name you want to give this field) to the primkey key (id) of the
parent table (our main form table).

The link master/child fields will thus be:

Master: ID
Child main_id


The "field" in the child table(s) used to link **back** to the main table is
a PLAIN JANE regular field, This field is NOT autonumber, it is NOT primkary
key, but is simply a regular plain jane long number field.
 

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