S
sbowman
I'm writing a function to provide the time to close for help desk
tickets. There are 6 different departments to take into consideration,
therefore my code looks like this:
Public Function TimeToClose(Dept, LanStatus, TechStatus_1,
TechStatus_2, TechStatus_3, TechStatus_4, _
TechStatus_5 As String, LanDueDate, Tech1DueDate, Tech2DueDate,
Tech3DueDate, Tech4DueDate, _
Tech5DueDate, LanAssignedDate, LanClosedDate, TechAssignedDate_1,
TechClosedDate_1, TechAssignedDate_2, _
TechClosedDate_2, TechAssignedDate_3, TechClosedDate_3,
TechAssignedDate_4, TechClosedDate_4, _
TechAssignedDate_5, TechClosedDate_5 As Date) As Date
If Right(Dept, 1) = "0" And LanStatus = "Closed" Then
TimeToClose = DateDiff("d", LanAssignedDate, LanClosedDate) + 1
ElseIf Right(Dept, 1) = "1" And TechStatus_1 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_1, TechClosedDate_1) +
1
ElseIf Right(Dept, 1) = "2" And TechStatus_2 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_2, TechClosedDate_2) +
1
ElseIf Right(Dept, 1) = "3" And TechStatus_3 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_3, TechClosedDate_3) +
1
ElseIf Right(Dept, 1) = "4" And TechStatus_4 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_4, TechClosedDate_4) +
1
ElseIf Right(Dept, 1) = "5" And TechStatus_5 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_5, TechClosedDate_5) +
1
End If
End Function
whenever i insert this function in to my query, access crashes. Is
Access unable to handle this many variables being passed to a function?
Thanks!
Shelley
tickets. There are 6 different departments to take into consideration,
therefore my code looks like this:
Public Function TimeToClose(Dept, LanStatus, TechStatus_1,
TechStatus_2, TechStatus_3, TechStatus_4, _
TechStatus_5 As String, LanDueDate, Tech1DueDate, Tech2DueDate,
Tech3DueDate, Tech4DueDate, _
Tech5DueDate, LanAssignedDate, LanClosedDate, TechAssignedDate_1,
TechClosedDate_1, TechAssignedDate_2, _
TechClosedDate_2, TechAssignedDate_3, TechClosedDate_3,
TechAssignedDate_4, TechClosedDate_4, _
TechAssignedDate_5, TechClosedDate_5 As Date) As Date
If Right(Dept, 1) = "0" And LanStatus = "Closed" Then
TimeToClose = DateDiff("d", LanAssignedDate, LanClosedDate) + 1
ElseIf Right(Dept, 1) = "1" And TechStatus_1 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_1, TechClosedDate_1) +
1
ElseIf Right(Dept, 1) = "2" And TechStatus_2 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_2, TechClosedDate_2) +
1
ElseIf Right(Dept, 1) = "3" And TechStatus_3 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_3, TechClosedDate_3) +
1
ElseIf Right(Dept, 1) = "4" And TechStatus_4 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_4, TechClosedDate_4) +
1
ElseIf Right(Dept, 1) = "5" And TechStatus_5 = "Closed" Then
TimeToClose = DateDiff("d", TechAssignedDate_5, TechClosedDate_5) +
1
End If
End Function
whenever i insert this function in to my query, access crashes. Is
Access unable to handle this many variables being passed to a function?
Thanks!
Shelley