jcaptchaos2
Well-known Member
- Joined
- Sep 24, 2002
- Messages
- 1,032
- Office Version
- 365
- Platform
- Windows
I have a tavle where I have the employee number and the date as primary keys which I though was working well. The table is for tracking the off time for a day. I have had to add a calculated field to the table which I call shift date as I had to add this formula to it.
I would like to have that date be a primary key along with the employee number but you can"t have a calculated field as a primary key. The problem with the regular date being a primary key is that if a 2nd shift employee who usually gets done at 11pm works until 1am the next morning they already have a shift off for that day and when they try and shift off the next day it will not let them. Any way around this?
Code:
IIf([shift]=2 And [Time Off]<0.167,[date]-1,IIf([shift]=3 And [Time Off]>0.75,[date]+1,[date]))