Nelville,
You'll need to include the date associated with each time.
DateDiff("h",Now(),[YourDate]+[YourTime])
would calculate the number of hours between Now, and your Date/Time values.
This can be a problem. If the goal is to calculate the number of hours to do
a task, often it's better to put this data into a number field and not
date/time.
If you need to extract such data from date/time entries, it's probably
better to convert it to a number.
Debug.Print CDbl(Now()- Date()) = 0.347245370372548 at 8:20am. So that
number converts to 8 hours and 20 minutes or just a little over a third of a
day.
You could also use the Hour and Minute functions to extra those parts of a
time.
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "ConvertStringStuff.mdb" which shows how to convert date/time
fields into strings to display them in hh:mm format. It shows how to add
these times.
I have some knowledge on this, I have a work order database that displays
elapsedtime as days hours minutes seconds
elapsedshorttime as hh:mm:ss
decimalequiv as 00.00
All the information you seek is available at microsoft online help. I
created a module called elapsed time and have all the functions inside there
for easy retrieval from code or macro. Here is a good place to start
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.