WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Primary key replication in two tables

 
   Home -> Office other -> Table Design RSS
Next:  Analyse Table creates Lookup tables and bloats th..  
Author Message
CBeavers

External


Since: Nov 10, 2008
Posts: 1



(Msg. 1) Posted: Mon Nov 10, 2008 1:04 pm
Post subject: Primary key replication in two tables
Archived from groups: microsoft>public>access>tablesdbdesign (more info?)

How do I create a link between two tables so that when I add a primary key
value to one table that it automatically adds the primary key value to the
second table.

It will be a one-to-one relationship.
I created a student personal data table and a Student Accommodations table.
I set the "enforce Referential Integrity” and “Cascade Update Related
Fields”.
The left table is tbl_students. The right table is
tbl_student_accommodations.
I imported a list of student data into tbl_students. I want them to show up
automatically in tbl_student_accommodations.

I created a form with tbl_student data as the main form and
tbl_student_accommodations in a subform. I linked child and parent using the
primary key student_ID.

The accommodations table has a default value set in the field for the test
type (TestForm) to be taken and other choices in a value list.

I can see the student_id in the accommodations subform with the default
“test1” in the TestForm field, but when I open the accommodations table, the
student id and the default test form are not showing up in the accommodations
table.

There are five different Test (each with their own set of “testForm”’s to
identify for each student record in the accommodations table.

Each student is in the accommodations table once but each student will have
five test forms identified. If I change from the default test form for any
one of the test, the student shows up in the accommodations table. But, if I
just leave it at the default test type, the student does not show up in the
accommodations table. What am I doing wrong…?
Back to top
Login to vote
Evi

External


Since: Oct 18, 2008
Posts: 10



(Msg. 2) Posted: Wed Nov 12, 2008 12:08 am
Post subject: Re: Primary key replication in two tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I'm not too sure about your design. Unless I've misunderstood something, you
need to have at least 3 tables. Student table, Accomodation Table and a
Student Accomodation table (this latter contains as Foreign Keys, StudentID
and AccomodationID which are the primary keys of StudentTable and
AccomodationTable).

The 3rd table is necessary because you will want, at some time, to keep a
historical record of which student stayed where. When your student moves
from one accomodation to another, you will want your db to 'remember' where
he lived previously. You will also want to know which accomodation is
available and which student doesn't have accommodation yet so your 1 to 1
won't work.

The rest of your explanation isn't clear to me because you haven't said what
sort of data 'Student Data' contains nor do I understand what those 'Tests'
are about so I don't know if they relate to the students, the accomodation
or the students in their accomodation. Concrete examples would be helpful.
Are you saying that Studentdata contains lists of students and their
accomodation in 1 table and you want to divide it into 2 tables.?

Evi




"CBeavers" <CBeavers RemoveThis @discussions.microsoft.com> wrote in message
news:A88BEBD9-5974-4AA9-BFF9-198EF641DC80@microsoft.com...
> How do I create a link between two tables so that when I add a primary key
> value to one table that it automatically adds the primary key value to the
> second table.
>
> It will be a one-to-one relationship.
> I created a student personal data table and a Student Accommodations
table.
> I set the "enforce Referential Integrity" and "Cascade Update Related
> Fields".
> The left table is tbl_students. The right table is
> tbl_student_accommodations.
> I imported a list of student data into tbl_students. I want them to show
up
> automatically in tbl_student_accommodations.
>
> I created a form with tbl_student data as the main form and
> tbl_student_accommodations in a subform. I linked child and parent using
the
> primary key student_ID.
>
> The accommodations table has a default value set in the field for the test
> type (TestForm) to be taken and other choices in a value list.
>
> I can see the student_id in the accommodations subform with the default
> "test1" in the TestForm field, but when I open the accommodations table,
the
> student id and the default test form are not showing up in the
accommodations
> table.
>
> There are five different Test (each with their own set of "testForm"'s to
> identify for each student record in the accommodations table.
>
> Each student is in the accommodations table once but each student will
have
> five test forms identified. If I change from the default test form for any
> one of the test, the student shows up in the accommodations table. But, if
I
> just leave it at the default test type, the student does not show up in
the
> accommodations table. What am I doing wrong.?
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> Table Design All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support