How to use this function

J

James

I'm new to access, could someone please give me some instructions on how I
could create a form or report that would call this function, and display its
result.


Function AddTimes()

Dim db As DAO.Database

Dim rs As DAO.Recordset

Dim time1 As Date

Dim time2 As Date

Dim TimeAccum As Integer



Set db = CurrentDb

Set rs = db.OpenRecordset("WebProxyLog1")

rs.MoveNext

Do

rs.MovePrevious

time1 = rs!logTime

rs.MoveNext

time2 = rs!logTime

If DateDiff("n", time1, time2) < 5 Then

TimeAccum = TimeAccum + DateDiff("n", time1, time2)

End If

rs.MoveNext

Loop Until rs.EOF

AddTimes = TimeAccum

Debug.Print AddTimes

End Function
 
Top