P
Peter Hemmingsen
Hi
I need to make an Access 2007 "Customer" database where a customer is either
a person or a married couple.
I've created a "Person" table with personal information such as name,
birthday, etc. The primary key in this table is an autogenerated number.
The "Customer" table have an autogenerated primary key value, some customer
information, and then ManID and WifeID fields reffering to the primary key
(autogenerated ID) in the "Person" table.
I've created a one-to-one relationship between ManID (and WifeID) from the
"Customer" table and the primary key (autogenerated ID) of the "Person"
table and checked the "Enforce Referential Integrity" and cascade
Update/delete.
Now when I (Using Access 2007) create a record in the customer table I can
press the + (left to the new created row in customer table) which will then
allow me to enter a record in the "Person" table. However I cant create a
row in the "Person" table. It seems like the auto generated ID for the
person record is not created at this stage and I get a "ID value can not be
null" error.
I know that I could change the design so that each record in "Person" have a
CustomerID field and if to persons was married they would simply have the
same CustomerID. But this could lead to errors where more than two person
would have the same customer ID. (The application does not support polygamy
)
Any suggestions to the design or how to correctly make the relationship
would be highly appreciated,- thanks
Peter
I need to make an Access 2007 "Customer" database where a customer is either
a person or a married couple.
I've created a "Person" table with personal information such as name,
birthday, etc. The primary key in this table is an autogenerated number.
The "Customer" table have an autogenerated primary key value, some customer
information, and then ManID and WifeID fields reffering to the primary key
(autogenerated ID) in the "Person" table.
I've created a one-to-one relationship between ManID (and WifeID) from the
"Customer" table and the primary key (autogenerated ID) of the "Person"
table and checked the "Enforce Referential Integrity" and cascade
Update/delete.
Now when I (Using Access 2007) create a record in the customer table I can
press the + (left to the new created row in customer table) which will then
allow me to enter a record in the "Person" table. However I cant create a
row in the "Person" table. It seems like the auto generated ID for the
person record is not created at this stage and I get a "ID value can not be
null" error.
I know that I could change the design so that each record in "Person" have a
CustomerID field and if to persons was married they would simply have the
same CustomerID. But this could lead to errors where more than two person
would have the same customer ID. (The application does not support polygamy
)
Any suggestions to the design or how to correctly make the relationship
would be highly appreciated,- thanks
Peter