Hello all,
I am having a bit of a brain freeze and I need help with this function call.
The following code is currently placed in a form. I also need to use the the same code for a report so I wanted to move the code to Module1 where I can call it from either the form or report.
The trouble I am having is what parameters I need to set up in the function.
I am just unsure how to set this up properly so both the form or the report can utilize the same code.
Thanks,
Stoss
I am having a bit of a brain freeze and I need help with this function call.
The following code is currently placed in a form. I also need to use the the same code for a report so I wanted to move the code to Module1 where I can call it from either the form or report.
The trouble I am having is what parameters I need to set up in the function.
Code:
On Error GoTo ErrHandler
If strPriority = "Priority 1 (Immediately)" Then
Me.txtClosedBy = "This discrepancy must be fixed IMMEDIATELY!"
'Sets Priority 2 Priorities
ElseIf strPriority = "Priority 2 (7-Days)" Then
If ([OPEN_DATE] + 7) >= Date Then
If ([OPEN_DATE] + 7) <> Date Then
Me.txtClosedBy = "This discrepancy is " & DateDiff("d", [OPEN_DATE], Date) & " day(s) old and must be closed by " & DateAdd("d", DateDiff("d", Date - 7, [OPEN_DATE]), Date) & ". (" & DateDiff("d", Date - 7, [OPEN_DATE]) & " day(s) remaining)"
Else
Me.txtClosedBy = "This discrepancy is due today!"
End If
Else
Me.txtClosedBy = "This discrepancy is past due by " & DateDiff("d", [OPEN_DATE] + 7, Date) & " day(s)."
End If
'Sets Priority 3 Priorities
ElseIf strPriority = "Priority 3 (30-Days)" Then
If ([OPEN_DATE] + 30) >= Date Then
If ([OPEN_DATE] + 30) <> Date Then
Me.txtClosedBy = "This discrepancy is " & DateDiff("d", [OPEN_DATE], Date) & " day(s) old and must be closed by " & DateAdd("d", DateDiff("d", Date - 30, [OPEN_DATE]), Date) & ". (" & DateDiff("d", Date - 30, [OPEN_DATE]) & " day(s) remaining)"
Else
Me.txtClosedBy = "This discrepancy is due today!"
End If
Else
Me.txtClosedBy = "This discrepancy is past due by " & DateDiff("d", [OPEN_DATE] + 30, Date) & " day(s)."
End If
'Sets Priority 4 Priorities
ElseIf strPriority = "Priority 4 (90-Days)" Then
If ([OPEN_DATE] + 90) >= Date Then
If ([OPEN_DATE] + 90) <> Date Then
Me.txtClosedBy = "This discrepancy is " & DateDiff("d", [OPEN_DATE], Date) & " day(s) old and must be closed by " & DateAdd("d", DateDiff("d", Date - 90, [OPEN_DATE]), Date) & ". (" & DateDiff("d", Date - 90, [OPEN_DATE]) & " day(s) remaining)"
Else
Me.txtClosedBy = "This discrepancy is due today!"
End If
Else
Me.txtClosedBy = "This discrepancy is past due by " & DateDiff("d", [OPEN_DATE] + 90, Date) & " day(s)."
End If
'Sets Priority 5 Priorities
ElseIf strPriority = "Priority 5 (As Required)" Then
Me.txtClosedBy = "This discrepancy needs to be completed at first convenient time."
Else
Me.txtClosedBy = "Priority needs to be change to reflect current standards."
End If
I am just unsure how to set this up properly so both the form or the report can utilize the same code.
Thanks,
Stoss