Function DDAvg(ParamArray A() As Variant) As Single
'示例:select *,DDAvg(字段1,字段2,字段3,字段4) as 平均值 from 表1
Dim i As Long
Dim S As Single
Dim C As Long
S = 0: C = 0
For i = 0 To UBound(A, 1)
If IsNumeric(A(i)) = True Then
S = S + A(i)
C = C + 1
End If
Next
If C <> 0 Then
DDAvg = S / C
Else
DDAvg = 0
End If
End Function 作者: xuwenning 时间: 2010-7-28 10:15
谢谢分享
继续学习Access小品作者: tmtony 时间: 2010-7-28 13:16
谢谢分享!作者: yanwei82123300 时间: 2010-7-29 11:08
谢谢分享
继续学习Access小品 作者: a59795923 时间: 2010-8-6 14:10
学习了辛苦楼主