relationship

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created 2 tables. I did a 1 to 1 relationship between them. The
problem is on the one table I have an ID that is an auto number that is
incrementing. The second table I set up an NewID which is a random number.
The problem is when the data is input. It generates the ID that is
incrementing. But it does not display and random number in the 2nd related
table that is a random auto number. Why isn't it putting a random number
into this NewID field?
 
I have created 2 tables. I did a 1 to 1 relationship between them. The
problem is on the one table I have an ID that is an auto number that is
incrementing. The second table I set up an NewID which is a random number.
The problem is when the data is input. It generates the ID that is
incrementing. But it does not display and random number in the 2nd related
table that is a random auto number. Why isn't it putting a random number
into this NewID field?

I think you may be misunderstanding how relationships work.

A one to one relationship is VERY rarely needed. If you're doing
"Subclassing", or need a second table for security related data which
has different permissions than your main data, then maybe a one to one
relationship is appropriate... but rarely otherwise.

Secondly, a relationship *constrains* what you can enter; it will
prevent you from entering a record in the second table unless there is
a matching record in the first table. It will NOT automagically create
a new record in the second table.

Could you explain what is in these two tables and what you are
attempting to accomplish? I suspect that there is another solution,
not involving one to one relationships.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
What I was attempting to do is have one table with a patients information in
it with it being auto numbered incrementing.
The second table is just going to have a genetic ID number in it which is a
random number. This table is used to refer back to the patients information,
so a person can only enter the genetic ID number to get some information from
the patients information table. Basiclly the genetic ID number is what will
identify a patient. With Genetic information you need and added level of
security.
 
What I was attempting to do is have one table with a patients information in
it with it being auto numbered incrementing.
The second table is just going to have a genetic ID number in it which is a
random number. This table is used to refer back to the patients information,
so a person can only enter the genetic ID number to get some information from
the patients information table. Basiclly the genetic ID number is what will
identify a patient. With Genetic information you need and added level of
security.

Since your second table will - must! - have a foreign key linking it
to the first table, I don't see how this gets you any additional
security at all.

Note that you can set the properties of an Autonumber field to Random;
there is no requirement that an autonumber be incrementing, nor even
that a table must have any sort of autonumber at all.

I think you can accomplish your desired goal without the need for this
second table; if you implement Access security on the database, you
can give different classes of users permission to view the data *only*
through queries which you control, and not be able to view the tables
at all.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top