UK_Lionheart
New member
- Local time
- Today, 00:11
- Joined
- Dec 13, 2012
- Messages
- 3
Hi all,
I am going mad with a Query problem in Access. I have a small database which tracks staff attendance against their contract. This has a main table with the staff details (key field StaffCode) which is linked to monthly tables where they can enter their start and end times and relevant jobs to assign hours against. The link is through StaffCode, so they can only add and amend their own hours.
I also have an amendment table (again, linked with StaffCode) which is for changes to their contracted hours.
Using a basic If Then, I was able to pull off a report which calculated their hours against the contract, by checkign any amedments and chaging the Expected Hours for the relevent weeks.
This was fine until, for reasons known only to the management, they changed somebodys contract twice on consecutive weeks. Now I get a multiple line on my report, which double counts the expected hours, showing this staff member as underperforming. If however, I suppress the second weeks, it gives everybody else a zero hours! Aarghhh!! :chomp:
This is my query:
IIF ([date] between [start date] and [end date],[weekly hours]+[amendment],[weekly hours]) which double counts hours as there is a change on 8th Oct and 15th Oct, so I see:
Date Start Date Expr
01/10 08/10 10
01/10 15/10 10
08/10 08/10 15
08/10 15/10 10
Which is no good!
I have tried to replace the "else" part of the statement with another IIF to make it set to zero, but if I do manage to resolve the issue with this recordset, I get zeros in all other staff members.
Any advice would be appreciated as I am tearing my hair out!
Thanks.
I am going mad with a Query problem in Access. I have a small database which tracks staff attendance against their contract. This has a main table with the staff details (key field StaffCode) which is linked to monthly tables where they can enter their start and end times and relevant jobs to assign hours against. The link is through StaffCode, so they can only add and amend their own hours.
I also have an amendment table (again, linked with StaffCode) which is for changes to their contracted hours.
Using a basic If Then, I was able to pull off a report which calculated their hours against the contract, by checkign any amedments and chaging the Expected Hours for the relevent weeks.
This was fine until, for reasons known only to the management, they changed somebodys contract twice on consecutive weeks. Now I get a multiple line on my report, which double counts the expected hours, showing this staff member as underperforming. If however, I suppress the second weeks, it gives everybody else a zero hours! Aarghhh!! :chomp:
This is my query:
IIF ([date] between [start date] and [end date],[weekly hours]+[amendment],[weekly hours]) which double counts hours as there is a change on 8th Oct and 15th Oct, so I see:
Date Start Date Expr
01/10 08/10 10
01/10 15/10 10
08/10 08/10 15
08/10 15/10 10
Which is no good!
I have tried to replace the "else" part of the statement with another IIF to make it set to zero, but if I do manage to resolve the issue with this recordset, I get zeros in all other staff members.
Any advice would be appreciated as I am tearing my hair out!
Thanks.