Hour Calculation

  • Thread starter Thread starter Sevi
  • Start date Start date
S

Sevi

Hi,

I am using MS Access table with three fields with date/time format

In
Out
Hourstaken

For example :

The filed 'IN' is entered as 17/02/09 05:24 PM and 'OUT' 20/02/09 11:46 AM.
How I can auto fill "Hourstaken" by calculation.

Smiles Sev
 
Create a query, and type an expression like this into the Field row:
DateDiff("n", [In], [Out]) / 60
The result will be in hours and fraction (e.g. 3.75.)

Note that you do not have an HoursTaken field in your table. Just use the
query as the source wherever you need the calculated field. Explanation in:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

Also note that IN is a reserved word, and OUT is future-reserved. It might
work with the square brackets around the names, but in general it's better
to avoid using reserved words as field names. Here's a list of names to
avoid:
http://allenbrowne.com/AppIssueBadWord.html
 
Back
Top