Hi,
I have a database with the following tables
tblStaffDetails tblGP
StaffID (Primary Key) GPID (Primary key)
name name
address address
telephone telephone
GPID (foreign key)
etc
so there is a 1 to M relationship between tblGP.GPID and tblStaffDetails.GPID
When a user deletes a tblGP record (i.e. GP(Dr Watson) has retired and therefore any staff member that used to have Dr Watson as their GP will no longer have a reference to this doctor, so tblSTaffDetails.GPID is either deleted or set to null until a new GP record is entered into tblGP and a new reference to that GP is set in tblSTaffDetails)
I thought this would be easy to accomplish by enforcing referential integrity and cascading deleted records. However this is not the case!!!
There are a number of other tables in the database that are all related to tblStaffDetails these include tblProfessionalTraining, tblEducation, tblNextofKin etc. Each of these tables have a field StaffID as the foreign key to relate the particular details to a specific member of staff (All 1 to M relationships).
So when i try to delete a GP record i get the message "cannot perform cascading operation. Since related records exist in table 'tblProfessionalTraing', referential integrity rules wold be violated."
I don't understand this message since all i want to delete is the tblGP record and the corresponing GPID for each staff member how had this GP.
The only way i found round this is to set enforce referential integrity (cascade update and cascade delete) for all tables in the database. However when i do this and then delete a GP record Access will allow me to do the delete but also deletes the tblstaffDetails record, so instead of just losing the GP record i lose all details about that member of staff as well!!!
Any advice would be appreciated
Dan
I have a database with the following tables
tblStaffDetails tblGP
StaffID (Primary Key) GPID (Primary key)
name name
address address
telephone telephone
GPID (foreign key)
etc
so there is a 1 to M relationship between tblGP.GPID and tblStaffDetails.GPID
When a user deletes a tblGP record (i.e. GP(Dr Watson) has retired and therefore any staff member that used to have Dr Watson as their GP will no longer have a reference to this doctor, so tblSTaffDetails.GPID is either deleted or set to null until a new GP record is entered into tblGP and a new reference to that GP is set in tblSTaffDetails)
I thought this would be easy to accomplish by enforcing referential integrity and cascading deleted records. However this is not the case!!!
There are a number of other tables in the database that are all related to tblStaffDetails these include tblProfessionalTraining, tblEducation, tblNextofKin etc. Each of these tables have a field StaffID as the foreign key to relate the particular details to a specific member of staff (All 1 to M relationships).
So when i try to delete a GP record i get the message "cannot perform cascading operation. Since related records exist in table 'tblProfessionalTraing', referential integrity rules wold be violated."
I don't understand this message since all i want to delete is the tblGP record and the corresponing GPID for each staff member how had this GP.
The only way i found round this is to set enforce referential integrity (cascade update and cascade delete) for all tables in the database. However when i do this and then delete a GP record Access will allow me to do the delete but also deletes the tblstaffDetails record, so instead of just losing the GP record i lose all details about that member of staff as well!!!
Any advice would be appreciated
Dan