Modules and Forms

J

James T.

Using Access 2000

After doing a little research I found the following Module
and have copied it to try and learn how forms relate to
modules. I would like to have a form where the user inputs
a DATE (04/11/05), a TIME(8:16AM) as a start time and also
enter a finish time (04/13/05 3:00PM) and have Access
calculate the days and hours between the two. I am looking
to understand how this module might help me. The text
within the link states "type such and such (dates and
time) into the Immeadiate window. Don't know what
the "Immeadiate window" is :-(

Any help or links appreciated.

Thanks,
James

'**********************************************************
*************
' This function calculates the elapsed time between two
values and then
' formats the result in four different ways.
' The function accepts interval arguments such as the
following:
'
' #5/12/95 6:00:00AM# - #5/11/95 10:00:00PM#
'
' [EndTime] - [StartTime]
'**********************************************************
*************

Function ElapsedTime(Interval)
Dim x
x = Int(CSng(Interval * 24 * 3600)) & " Seconds"
Debug.Print x
x = Int(CSng(Interval * 24 * 60)) & ":" & Format
(Interval, "ss") & " Minutes:Seconds"
Debug.Print x
x = Int(CSng(Interval * 24)) & ":" & Format
(Interval, "nn:ss") & " Hours:Minutes:Seconds"
Debug.Print x
x = Int(CSng(Interval)) & " days" & Format
(Interval, "hh") & " Hours " & Format(Interval, "nn") & "
Minutes " & Format(Interval, "ss") & " Seconds"
Debug.Print x

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top