R
Radhika
How can I add a function to an expression in query? I have the following
expression:
OPSE Avg All: (Nz([OPSE cracker Avg],0)+Nz([OPSE Pudding Avg],0)+Nz([OPSE 10
ml Avg],0))/CountItems([OPSE cracker Avg],[OPSE Pudding Avg],[OPSE 10 ml Avg])
I created a module called CountItems as follows:
Public Function CountItems(ParamArray varItems()) As Long
'Purpose: Count the number of non-null items passed in.
'Example: CountItems([OPSE cracker Avg Avg], [OPSE Pudding Avg],
[OPSE 10 ml Avg])
Dim i As Integer
Dim lngCount As Long
For i = LBound(varItems) To UBound(varItems)
If Not IsNull(varItems(i)) Then
lngCount = lngCount + 1
End If
Next
CountItems = lngCount
End Function
How do I incorporate this into the expression. If I try to run the query, it
gives me a msg saying "Undefined function CountItems in expression"
How can I solve this?
Thankyou,
Radhika
expression:
OPSE Avg All: (Nz([OPSE cracker Avg],0)+Nz([OPSE Pudding Avg],0)+Nz([OPSE 10
ml Avg],0))/CountItems([OPSE cracker Avg],[OPSE Pudding Avg],[OPSE 10 ml Avg])
I created a module called CountItems as follows:
Public Function CountItems(ParamArray varItems()) As Long
'Purpose: Count the number of non-null items passed in.
'Example: CountItems([OPSE cracker Avg Avg], [OPSE Pudding Avg],
[OPSE 10 ml Avg])
Dim i As Integer
Dim lngCount As Long
For i = LBound(varItems) To UBound(varItems)
If Not IsNull(varItems(i)) Then
lngCount = lngCount + 1
End If
Next
CountItems = lngCount
End Function
How do I incorporate this into the expression. If I try to run the query, it
gives me a msg saying "Undefined function CountItems in expression"
How can I solve this?
Thankyou,
Radhika