Kumba1
Technical User
- Aug 29, 2002
- 94
Does this code look good to you guys? I'm trying to make a modular function to do monthly averages...Basically, I wanna call the function, passing a specified date, and the field for it to calculate from a predetermined table...
Function MTDAverage(mtdDate As Date, mtdField As String) As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
z = "#01/01/" & Year(mtdDate) & ""
y = DCount("[BuildCode]", "tblBuilds", "" & mtdField & " > " & z & ""
x = y / Month(mtdDate)
MTDAverage = x
End Function
Function MTDAverage(mtdDate As Date, mtdField As String) As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
z = "#01/01/" & Year(mtdDate) & ""
y = DCount("[BuildCode]", "tblBuilds", "" & mtdField & " > " & z & ""
x = y / Month(mtdDate)
MTDAverage = x
End Function