2 identical records

  • Thread starter Thread starter Hasan
  • Start date Start date
H

Hasan

hi,
i'm getting 2 identical primary fields during my
migration of databases. i want to show same autonumber
for both these records in the new table but the database
treats both rows and seperate and won't allow me to have
one parent number or primary key for both these
records.
 
Hasan

By definition, a primary key is unique. And by design, an Autonumber
created by Access is unique (that's why it serves well as an arbitrary,
unique row ID).

Can you further describe your situation? Why would you want the same
primary key on more than one record? Would that mean you'd never know which
one you'd get?
 
Alrite, c if this makes sense.
you have a objects in object table which is 1 row per
object then in the objectdetail table we have several row
corresponding to the one object in the object table. this
is easy to work out but if i have the details table and
need to make the object table, in other words working
backward to build a parent table.
How would i write the query so it will only add 1 row in
the object table even though there could be 5+
objectdetails rows.
i tried teh keywaor DISTINCT but that just eliminates the
duplicate fields totaly, doesn't allow me to use even one
of teh rows.
 
Hasan

If you have a table that has more than one row with the same "parent" ID (as
you might with an OrderDetail table), you can use an append query to add in
unique rows to an empty parent table.

First create the parent table. Then put an index (no duplicates) on the
field that will hold the ID.

Finally, create an append query from the OrderDetail table to the parent
table, appending the parentID to it's field in the parent table.

When Access encounters a key value already entered in the parent table, it
will refuse to enter any others that might show up in OrderDetail records.
Thus, one each parent ID will be entered, no matter how many times that
parent ID appears in OrderDetail records.
 
Back
Top