difference in time query

  • Thread starter Thread starter djs35
  • Start date Start date
D

djs35

Guest
Hi,

I am relatively new to the programming end of things, and had a question (how to do something) that I have not been able to figure out.

I have a table called "MaintenanceTbl". In the table, there are two fields called "StartTime" and "StopTime". Each fields stores a date and time. I created a form using access wizard, that allows me to store start and stop times (and even I figured out how to get it to load the start time automatically, and the stop when I press a button). However, I cannot figure out how to get it to place the difference in time (minutes) in another field called "DiffTime". I tried the following query:

select datediff(minute,NT1.StartTime, NT2.StopTime) as DiffTime from
(select min(time) as StartTime from MaintenanceTBL where msg='start') NT1,
(select max(time) as StopTime from MaintenanceTBL where msg='stop') NT2

But, this does not work. Any advice?
 
What I do for a query field is

TimeDiff:([TimeField2]-[TimeField1])*86400

and that gives me the answer in sceonds.

Mike
 

Users who are viewing this thread

Back
Top Bottom