Difference in minutes between two time fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to calculate the difference in minutes between two fields and
place the result in a 3rd field. The first two fields are data type
"date/time" for the format is Medium date. The 3rd field is data type
"number" with a field size of "long integer"
 
You can calculate the difference in minutes with:
DateDiff("n",[StartDateTime],[EndDateTime])

However, you should NOT store this value, since you can calculate it
whenever you need it. Here's the standard warning from MVP John Vinson,
which appears regularly in this newsgroup:

"Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact."

HTH,

Rob
 
thanks VERY much

Rob Parker said:
You can calculate the difference in minutes with:
DateDiff("n",[StartDateTime],[EndDateTime])

However, you should NOT store this value, since you can calculate it
whenever you need it. Here's the standard warning from MVP John Vinson,
which appears regularly in this newsgroup:

"Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact."

HTH,

Rob


Ed Crawford said:
I'm trying to calculate the difference in minutes between two fields and
place the result in a 3rd field. The first two fields are data type
"date/time" for the format is Medium date. The 3rd field is data type
"number" with a field size of "long integer"
 

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

Access 2007 2
Formatting time sum field 5
Time Calculations..subtracting Minutes 3
Splitting fields in access 2010 0
Converting Data Types 7
Calculation 1
Difference in time 1
Access 2010 query for 3 tables 0

Back
Top