Primary Key & Foriegn Key

T

TSG

John said:
-

How do I mke sure that my related tables update the correct records i
a
one-to-many relationship. For example, I'm creating a database for
teachers to use in the classroom, so I have a studpersonal table and a
parent conference table that are related so that a teacher can record
the outcomes of a parent conference. Well, my PK and FK seem to b
out
of sync because the information gets posted to the wrong studen
record
when I use the form and subform to enter the information. I have a
combo box on the main form to select the correct student and a subform
to record the conference info. Is my structure or something wrong?
Have I provided enough info?-

The link from primary key to foreign key is implemented using the
Master Link Field and Child Link Field properties of the Subform
control; the Master should be the name of the primary key of the
mainform's table, and the Child should be the name of the foreign key
field in the subform's recordsource. Are these correct?

Just having a table relationship does NOT cause anything to
automagically get filled in anywhere!

John W. Vinson[MVP]


John,
Please excuse the simplicity of my questions, I'm fairly new to this.
I'm not quite sure if I understand you when you talk about the Maste
and Child link being in the subform properties? Are talking about th
subdatasheets or something completely different
 
J

John Vinson

John,
Please excuse the simplicity of my questions, I'm fairly new to this.
I'm not quite sure if I understand you when you talk about the Master
and Child link being in the subform properties? Are talking about the
subdatasheets or something completely different?

Yes: completely different.

It sounds like you are using table datasheets to enter your data. DON'T.
Table datasheets (even with Lookup Fields and subdatasheets) are of very
limited utility, and are best reserved for design and debugging.

For productive interaction with your data, you should use Forms. Create a
Form based on your "one" side table, and a Subform (using the Forms design
toolbox wizard Subform tool) for the "many" side table. The wizard will ask
you what fields to use for the linkage between the form and the subform; or
you can bypass the wizard, and view the Properties of the subform control.
Two of these properties are the "Master Link Field" - which should be a field
in the main form's table, or the name of a textbox or other control on the
mainform; and the "Child Link Field", which must be the name of the field in
the Subform's recordsource table to which the main table is linked.

John W. Vinson/MVP
 

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