J
jh
I am trying to autopopulate a field. I need help! Thanks
in advance.
The user picks a service and it has CommitDays associated
with it. So let's say CommitDays = 10 - this is
automatically populated.
DUEDATE is automatically populated to calculate 10 days
from the STARTDATE which is entered. What I am trying to
do is autopopulate the field "SLAStatus" based on the
below criteria:
The criteria for SLASTATUS is:
StartDate DueDate Percent* SLAStatus
should be
9/21 10/5 110 "Red"
9/22 10/6 100 "Red"
9/23 10/7 90 "Yellow"
9/24 10/8 80 "Green"
Legend:
0 - 85% of time passed = Green
If Actual End Date <= Target Date, Green
86 - 90% of time passed = Yellow
91% and over of time passed = Red
If Actual End Date >= Target Date, Red
ElseIf
If there is an ActualEndDate, then calculate the StartDate
to ActualEndDate.
If ActualEndDate is >DueDate, then SLAStatus should
be "Red".
If ActualEndDate is <=DueDate, then SLAStatus should
be "Red".
'HERE'S MY CODE:
If IsDate(Me.ActualEnd) Then
intOverDueDays = (CalcBusinessDays(datStart,
Me.ActualEnd)) - Me.CommittedDays
intLapsedDays = CalcBusinessDays(datStart,
Me.ActualEnd)
Select Case intOverDueDays
Case Is > 0
strMsg = "Red"
Case Is = 0
strMsg = "Green"
Case Is < 0
strMsg = "Green"
End Select
intPercent = SetStatusPercent(intDaysToTarget,
intLapsedDays, "Y")
Else
intOverDueDays = CalcBusinessDays(datStart,
datCurrent) - Me.CommittedDays
intLapsedDays = CalcBusinessDays(datStart, datCurrent)
Select Case intOverDueDays
Case Is > 0
strMsg = "Red"
Case Is = 0
strMsg = "Now Due!"
Case Is < 0
strMsg = "Green"
End Select
'AND HERE'S MY MODULE
Public Function SetStatusPercent(daystotarget As Integer,
dayslapsed As Integer, ActualEndDateFlag As String) As Long
Dim Percent As Integer
Dim color As Long
Dim green As Long
Dim yellow As Long
Dim red As Long
red = 255
green = 32768
yellow = 65535
If ActualEndDateFlag = "Y" Then
If dayslapsed <= daystotarget Then
Percent = 0
Else
Percent = 100
End If
Else
Percent = (dayslapsed / daystotarget) * 100
End If
SetStatusPercent = Percent
End Function
in advance.
The user picks a service and it has CommitDays associated
with it. So let's say CommitDays = 10 - this is
automatically populated.
DUEDATE is automatically populated to calculate 10 days
from the STARTDATE which is entered. What I am trying to
do is autopopulate the field "SLAStatus" based on the
below criteria:
The criteria for SLASTATUS is:
StartDate DueDate Percent* SLAStatus
should be
9/21 10/5 110 "Red"
9/22 10/6 100 "Red"
9/23 10/7 90 "Yellow"
9/24 10/8 80 "Green"
Legend:
0 - 85% of time passed = Green
If Actual End Date <= Target Date, Green
86 - 90% of time passed = Yellow
91% and over of time passed = Red
If Actual End Date >= Target Date, Red
ElseIf
If there is an ActualEndDate, then calculate the StartDate
to ActualEndDate.
If ActualEndDate is >DueDate, then SLAStatus should
be "Red".
If ActualEndDate is <=DueDate, then SLAStatus should
be "Red".
'HERE'S MY CODE:
If IsDate(Me.ActualEnd) Then
intOverDueDays = (CalcBusinessDays(datStart,
Me.ActualEnd)) - Me.CommittedDays
intLapsedDays = CalcBusinessDays(datStart,
Me.ActualEnd)
Select Case intOverDueDays
Case Is > 0
strMsg = "Red"
Case Is = 0
strMsg = "Green"
Case Is < 0
strMsg = "Green"
End Select
intPercent = SetStatusPercent(intDaysToTarget,
intLapsedDays, "Y")
Else
intOverDueDays = CalcBusinessDays(datStart,
datCurrent) - Me.CommittedDays
intLapsedDays = CalcBusinessDays(datStart, datCurrent)
Select Case intOverDueDays
Case Is > 0
strMsg = "Red"
Case Is = 0
strMsg = "Now Due!"
Case Is < 0
strMsg = "Green"
End Select
'AND HERE'S MY MODULE
Public Function SetStatusPercent(daystotarget As Integer,
dayslapsed As Integer, ActualEndDateFlag As String) As Long
Dim Percent As Integer
Dim color As Long
Dim green As Long
Dim yellow As Long
Dim red As Long
red = 255
green = 32768
yellow = 65535
If ActualEndDateFlag = "Y" Then
If dayslapsed <= daystotarget Then
Percent = 0
Else
Percent = 100
End If
Else
Percent = (dayslapsed / daystotarget) * 100
End If
SetStatusPercent = Percent
End Function