I am trying to write my first user-defined function and, of course, things are not going well. The function I wrote is:
Public Function BinData(dValue As Double) As String
If (dValue > 0) And _
(dValue < 1) Then
BinData = "Group 1"
Else If (dValue > 1) And _
(dValue < 2) Then
BinData = "Group 2"
Else If (dValue > 2) And _
(dValue < 3) Then
BinData = "Group 3"
Else If (dValue > 3) And _
(dValue < 4) Then
BinData = "Group 4"
Else If (dValue > 4) And _
(dValue < 5) Then
BinData = "Group 5"
End If
End Function
I pass this function the field name in a table of the calling expression is:
Expr1: BinData([SLRtbl Fuel Ass'y Discharges]![SLR_Init_Enrich])
and was hoping to get this function to assign the value to a category. When I run the function, I get the error message:
"Undefined function in an expression."
I went to the help screen but the message returned was not very useful. Is there anything obvioous that I can do? I expect my error is simple but I have never done this before and the text I have hasn't been very helpful either. Thanks.
Public Function BinData(dValue As Double) As String
If (dValue > 0) And _
(dValue < 1) Then
BinData = "Group 1"
Else If (dValue > 1) And _
(dValue < 2) Then
BinData = "Group 2"
Else If (dValue > 2) And _
(dValue < 3) Then
BinData = "Group 3"
Else If (dValue > 3) And _
(dValue < 4) Then
BinData = "Group 4"
Else If (dValue > 4) And _
(dValue < 5) Then
BinData = "Group 5"
End If
End Function
I pass this function the field name in a table of the calling expression is:
Expr1: BinData([SLRtbl Fuel Ass'y Discharges]![SLR_Init_Enrich])
and was hoping to get this function to assign the value to a category. When I run the function, I get the error message:
"Undefined function in an expression."
I went to the help screen but the message returned was not very useful. Is there anything obvioous that I can do? I expect my error is simple but I have never done this before and the text I have hasn't been very helpful either. Thanks.