Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding difference between times in a table 1

Status
Not open for further replies.

neillovell

Programmer
Aug 27, 2002
560
GB
Hi,
I have a table with some fields, two of which are TimerStart and TimerStop, both long time format (e.g. 06:09:30). I'm trying to find out how to find the difference between two fields and put it in to the TimeTaken field.

So 10:00:00 and 15:27:01 would return 05:27:01 as this is how long it has taken to do this.

In forms I know I can use VBA to calculate this when focus is lost etc. but I need this in the table because I'm accessing the database via a website.

Thoughts?
 
I would not store this in a table. You can calculate it in a query and access the query in the same way you would access the table.

To do this, it's probably easiest to make a function that uses datediff to get the difference in the two times in seconds and then convert that to hours, minutes, and seconds. Then you can use the function in your query and you'll have your results right there.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top