
Signature
-The Novice
Learn Today, Teach Tomorrow
Great Success is ones ability to ask for Help.
You need a field to record ‘Supervisor Excuses the Missed Day’
tblEmpSchd is only for one week. How do you track the week before?

Signature
KARL DEWEY
Build a little - Test a little
> To the Best of the Best (yes I am sucking-up early),
>
[quoted text clipped - 43 lines]
> (tblPointdata)will be updated with the points that need to be assessed to
> each employee.
TheNovice - 30 Jan 2008 17:04 GMT
I am not looking per week, this is a Rolling 6 months.
I do have the Info for the Excused Days, and those are filtered out through
a query.
Any Ideas?

Signature
-The Novice
Learn Today, Teach Tomorrow
Great Success is ones ability to ask for Help.
> You need a field to record ‘Supervisor Excuses the Missed Day’
> tblEmpSchd is only for one week. How do you track the week before?
[quoted text clipped - 46 lines]
> > (tblPointdata)will be updated with the points that need to be assessed to
> > each employee.
KARL DEWEY - 30 Jan 2008 18:31 GMT
>>I am not looking per week, this is a Rolling 6 months.
Does this mean that everyone is on the same shift schedule for six months?
>>I do have the Info for the Excused Days, and those are filtered out through
a query.
That information is necessary to calculate points correctly. Based on your
table presented points can not be calculated.

Signature
KARL DEWEY
Build a little - Test a little
> I am not looking per week, this is a Rolling 6 months.
>
[quoted text clipped - 53 lines]
> > > (tblPointdata)will be updated with the points that need to be assessed to
> > > each employee.
TheNovice - 30 Jan 2008 20:16 GMT
I have since made chages to to Db. The data that is extracted from our time
clock systems has the Shift at the time the driver clocks in or out. so the
information is always there no matter the change in schedules. Schedule
changes are done to begin the following week (or later) so there is no
conflict in schedules.
the tblEmpSched only has the esWrkSchdCode and Days and the tblPointdata has
always had WrkSchdCode field.
I just need a sample code that can get me started and I can test and modify
on the fly if necessary.

Signature
-The Novice
Learn Today, Teach Tomorrow
Great Success is ones ability to ask for Help.
> >>I am not looking per week, this is a Rolling 6 months.
> Does this mean that everyone is on the same shift schedule for six months?
[quoted text clipped - 61 lines]
> > > > (tblPointdata)will be updated with the points that need to be assessed to
> > > > each employee.
Jeff Boyce - 31 Jan 2008 13:17 GMT
You may want "the sample code ...", but Karl is pointing out that the data
needed to do the calculation was not available. Can you write out the
formula for the calculation you want, using the fields you currently have?
If so, post it back here. The "sample code" you are asking us to write will
have to start with you!
Good luck!

Signature
Regards
Jeff Boyce
www.InformationFutures.net
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/
Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
> I have since made chages to to Db. The data that is extracted from our time
> clock systems has the Shift at the time the driver clocks in or out. so the
[quoted text clipped - 73 lines]
> > > > > (tblPointdata)will be updated with the points that need to be assessed to
> > > > > each employee.
Robert Morley - 31 Jan 2008 17:44 GMT
But if he's already filtering out days that the manager has excused, as he
said he is, then there's no problem. That would naturally create a gap in
the consecutive dates, causing the point count to reset as though that day
had been worked normally.
Or have I missed something?
Rob
> You may want "the sample code ...", but Karl is pointing out that the data
> needed to do the calculation was not available. Can you write out the
[quoted text clipped - 3 lines]
>
> Good luck!
I'm not sure quite how tblEmpSchd fits into this, so I'm ignoring it for
now. If it's for people who work other than M-F, then you'll have to
massively re-write teh IsConsecutive function, and possibly the SickPoints
function. For now, I'm assuming that all employees work M-F. I've also
assumed that tblPointData already has entries in it for each EmployeeID and
Date for the last six months, and only needs to be updated with sick points.
Given that, I would structure the code something like this (this is VERY
light on details and probably won't do everything you need, but should give
you a rough outline to start from...it's also untested, so there may be bugs):
Public Function IsConsecutive(ByVal FirstDay As Date, ByVal NextDay As Date)
As Boolean
'Depending on the structure of your query, etc., you may need to
'expand this significantly to discount holidays, etc.
IsConsecutive = ((NextDay - FirstDay) = 1) Or _
(((NextDay - FirstDay) = 3) And _
(Weekday(FirstDay, vbSunday) = vbFriday) And _
(Weekday(NextDay, vbSunday) = vbMonday))
End Function
Public Function SickPoints(ByVal ThisDay As Date, ByVal PointsSoFar As
Double) As Double
'Returns 1 or 1.5, depending on weekday
'Or returns the difference if more than 2 points accumulated.
'Thus stopping at 2 points.
Dim dblSickPoints as Double
Select Case Weekday(ThisDay, vbSunday)
Case vbMonday, vbFriday
dblSickPoints = 1.5
Case Else
dblSickPoints = 1
End Select
If PointsSoFar + dblSickPoints > 2 Then dblSickPoints = 2 - PointsSoFar
End Function
'Fragment of main code: assumes table is open as recordset called rs,
'ordered by pdEmpID, pdClkIn.
Dim strEmpID As String
Dim dtClkIn As Date
With rs
strEmpID = vbNullString
dtClkIn = 0
Do Until .EOF
If strEmpID <> !pdEmpID.Value Then
dblPtsSoFar = 0
strEmpID = !pdEmpID.Value
dtClkIn = !pdClkIn.Value
End If
If !pdType = "NOP S" Then
If Not IsConsecutive(dtClkIn, !pdClkIn.Value) Then _
dblPtsSoFar = 0
!pdPoints.Value = SickPoints(!pdClkIn.Value, dblPtsSoFar)
dblPtsSoFar = dblPtsSoFar + !pdPoints.Value
.Update
Else
dblPtsSoFar = 0
End
.MoveNext
Loop
End With
As I said, the above will definitely need some testing and debugging, as I'm
writing this completely off the top of my head, and there were things I
didn't necessarily understand. But give it a whirl and see where it gets you.
Rob
> To the Best of the Best (yes I am sucking-up early),
>
[quoted text clipped - 43 lines]
> (tblPointdata)will be updated with the points that need to be assessed to
> each employee.
TheNovice - 01 Feb 2008 00:02 GMT
Robert,
There is an old adage that says “Give a man a Fish, he eats for a Day, teach
him how to fish and he eats for a lifetime.
This is my starting point, and I greatly appreciate the push.
Charles Davis

Signature
-The Novice
Learn Today, Teach Tomorrow
Great Success is ones ability to ask for Help.
> I'm not sure quite how tblEmpSchd fits into this, so I'm ignoring it for
> now. If it's for people who work other than M-F, then you'll have to
[quoted text clipped - 114 lines]
> > (tblPointdata)will be updated with the points that need to be assessed to
> > each employee.