S
sbowman
I have a very complex query with about 50 fields - 10 fields are
results of different public functions. One in particular is giving me
trouble by returning a bunch of #Error results. It returns some valid
results, but mainly the #Errors. Here's the function:
Public Function TechAssigned(Dept, LanAdmin, Tech_1, Tech_2, Tech_3,
Tech_4, Tech_5 As String) As String
If Right(Dept, 1) = "0" And LanAdmin <> "" Then
TechAssigned = LanAdmin
ElseIf Right(Dept, 1) = "1" And Tech_1 <> "" Then
TechAssigned = Tech_1
ElseIf Right(Dept, 1) = "2" And Tech_2 <> "" Then
TechAssigned = Tech_2
ElseIf Right(Dept, 1) = "3" And Tech_3 <> "" Then
TechAssigned = Tech_3
ElseIf Right(Dept, 1) = "4" And Tech_4 <> "" Then
TechAssigned = Tech_4
ElseIf Right(Dept, 1) = "5" And Tech_5 <> "" Then
TechAssigned = Tech_5
Else
TechAssigned = "Not Specified"
End If
End Function
And here's the way I'm calling it in the query design view:
TechName:
TechAssigned([Department],[LanAdmin],[Tech_1],[Tech_2],[Tech_3],[Tech_4],[Tech_5])
HELP!! This is driving me nuts!
Thanks
Shelley
results of different public functions. One in particular is giving me
trouble by returning a bunch of #Error results. It returns some valid
results, but mainly the #Errors. Here's the function:
Public Function TechAssigned(Dept, LanAdmin, Tech_1, Tech_2, Tech_3,
Tech_4, Tech_5 As String) As String
If Right(Dept, 1) = "0" And LanAdmin <> "" Then
TechAssigned = LanAdmin
ElseIf Right(Dept, 1) = "1" And Tech_1 <> "" Then
TechAssigned = Tech_1
ElseIf Right(Dept, 1) = "2" And Tech_2 <> "" Then
TechAssigned = Tech_2
ElseIf Right(Dept, 1) = "3" And Tech_3 <> "" Then
TechAssigned = Tech_3
ElseIf Right(Dept, 1) = "4" And Tech_4 <> "" Then
TechAssigned = Tech_4
ElseIf Right(Dept, 1) = "5" And Tech_5 <> "" Then
TechAssigned = Tech_5
Else
TechAssigned = "Not Specified"
End If
End Function
And here's the way I'm calling it in the query design view:
TechName:
TechAssigned([Department],[LanAdmin],[Tech_1],[Tech_2],[Tech_3],[Tech_4],[Tech_5])
HELP!! This is driving me nuts!
Thanks
Shelley