CJBIRKIN
Drink!
- Local time
- Today, 14:40
- Joined
- May 10, 2002
- Messages
- 255
Hi
Thanks to Len Boorman for his previous help with this we went through this recently and came up with the following ( i'll take responsibility for any balls-ups!)
Basically . I want to be able to create a unique work shift that allows mutliple staff members to be assigned to each shift but as each shift is at a different physical location i need to make sure that a staff member is not a 2 locations at the same time.
The tables are:
TBL_LOCATION (unit/theatre)
Location_ID (PK)
Location Desc
TBL_SHIFT
Location_ID_FK
Date_Stamp(PK)
AM_PM(PK) (lookup, whether the shift is the morning or the afternoon)
Staff_ID_FK(PK)
TBL_STAFF
Staff_ID(pk)(autonumber)
.......
In this case as i have indexed Date_Stamp, AM_PM, Staff_ID_FK
i hope that this will mean that the member of staff cannot be entered twice on the sameday;
I believe that if the Location_ID_FK is made a key then this would only prevent the person appearing on the sameday and time in the same location, not in all locations.
Allowed:TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............2................12/08/2003......pm................1
.............2................12/08/2003......am................2
Not allowed: TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............2................12/08/2003......am................1
.............2................12/08/2003......am................2
Not allowed: TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............1................12/08/2003......am................1
.............2................12/08/2003......am................2
Now the ? is can i normalize TBL_SHIFT if you look at a longer data set you can see that the first three fields continually repeat them selves
TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............1................12/08/2003......am................2
.............1................12/08/2003......am................3
.............1................12/08/2003......am................4
.............1................12/08/2003......am................5
.............1................12/08/2003......am................6
.............1................12/08/2003......am................7
.............1................12/08/2003......am................8
Is it possible to have one table with the shift and another with the staff i.e so you only enter the date data in once and still prevent the member of staff appearing in two locations at the same time?
This would make the life of the user a hell of a lot easier.
Any help gratefully received.
Cheers
Chris
EDIT:
Would it be logical to remove Staff_ID_FK from TBL_SHIFT and create a second table (TBL_STAFF_ONSHIFT) that has the Location_ID_FK, Date_stamp, am/pm from TBL_SHIFT with Staff_ID_FK and index Staff_ID_FK ,Date_stamp, am/pm ??
Thanks to Len Boorman for his previous help with this we went through this recently and came up with the following ( i'll take responsibility for any balls-ups!)
Basically . I want to be able to create a unique work shift that allows mutliple staff members to be assigned to each shift but as each shift is at a different physical location i need to make sure that a staff member is not a 2 locations at the same time.
The tables are:
TBL_LOCATION (unit/theatre)
Location_ID (PK)
Location Desc
TBL_SHIFT
Location_ID_FK
Date_Stamp(PK)
AM_PM(PK) (lookup, whether the shift is the morning or the afternoon)
Staff_ID_FK(PK)
TBL_STAFF
Staff_ID(pk)(autonumber)
.......
In this case as i have indexed Date_Stamp, AM_PM, Staff_ID_FK
i hope that this will mean that the member of staff cannot be entered twice on the sameday;
I believe that if the Location_ID_FK is made a key then this would only prevent the person appearing on the sameday and time in the same location, not in all locations.
Allowed:TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............2................12/08/2003......pm................1
.............2................12/08/2003......am................2
Not allowed: TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............2................12/08/2003......am................1
.............2................12/08/2003......am................2
Not allowed: TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............1................12/08/2003......am................1
.............2................12/08/2003......am................2
Now the ? is can i normalize TBL_SHIFT if you look at a longer data set you can see that the first three fields continually repeat them selves
TBL_SHIFT
Location_ID_FK.....Date_stamp...am/pm......Staff_ID_FK
.............1................12/08/2003......am................1
.............1................12/08/2003......am................2
.............1................12/08/2003......am................3
.............1................12/08/2003......am................4
.............1................12/08/2003......am................5
.............1................12/08/2003......am................6
.............1................12/08/2003......am................7
.............1................12/08/2003......am................8
Is it possible to have one table with the shift and another with the staff i.e so you only enter the date data in once and still prevent the member of staff appearing in two locations at the same time?
This would make the life of the user a hell of a lot easier.
Any help gratefully received.
Cheers
Chris
EDIT:
Would it be logical to remove Staff_ID_FK from TBL_SHIFT and create a second table (TBL_STAFF_ONSHIFT) that has the Location_ID_FK, Date_stamp, am/pm from TBL_SHIFT with Staff_ID_FK and index Staff_ID_FK ,Date_stamp, am/pm ??
Last edited: