This seems to be a monster problem for me but I have the nagging feeling I'm missing something obvious.
I have a number of tables in my database:
tblEmployees - Employee Details
tblCourses - Course Details
tblCourseVariables - Course Details which can change with different occurences of the course
tblEmployeeCourses - Details of courses an employee has been on.
My problem concerns the last table.
Currently the primary keys in tblEmployeeCourses are the Employee's ID and the Course Code. The other fields are Date of notification, status, Course Date, Times Cancelled, and Date of Refresher.
The employee needs to go on a course so a new record is entered with Status: "Needed"
When the Status is changed to "Booked On" a Course Date is entered"
When the course date arrives, the status is changed to "Completed". And if necessary, Date of Refresher is filled in.
The problem is, if a refresher is needed, this means the employee will be going on the same course again at a later date but this information will not be able to be entered since it would duplicate the primary key, "Course Code" and "Employee No" so really "Course Date" should be part of the primary key as well. But the course date is null when the record is first entered at least until the status is changed to Booked On so it can't be part of the primary key because it can't be null at any point!
Soooooo, any ideas on how I deal with this? Do I need to add another field to differentiate between records or is there another way?
Thanks for any help,
Cheers,
Pete
I have a number of tables in my database:
tblEmployees - Employee Details
tblCourses - Course Details
tblCourseVariables - Course Details which can change with different occurences of the course
tblEmployeeCourses - Details of courses an employee has been on.
My problem concerns the last table.
Currently the primary keys in tblEmployeeCourses are the Employee's ID and the Course Code. The other fields are Date of notification, status, Course Date, Times Cancelled, and Date of Refresher.
The employee needs to go on a course so a new record is entered with Status: "Needed"
When the Status is changed to "Booked On" a Course Date is entered"
When the course date arrives, the status is changed to "Completed". And if necessary, Date of Refresher is filled in.
The problem is, if a refresher is needed, this means the employee will be going on the same course again at a later date but this information will not be able to be entered since it would duplicate the primary key, "Course Code" and "Employee No" so really "Course Date" should be part of the primary key as well. But the course date is null when the record is first entered at least until the status is changed to Booked On so it can't be part of the primary key because it can't be null at any point!
Soooooo, any ideas on how I deal with this? Do I need to add another field to differentiate between records or is there another way?
Thanks for any help,
Cheers,
Pete