= Format("h:m:s")

  • Thread starter Thread starter dinellest
  • Start date Start date
D

dinellest

I have built a calculation in access that takes "time 2" - "time 1" and
provides a result of the lasped times. The expression gives back the answer.
It looks like

Expr1 0.00106481481634546

Now if I export it to Excel and format the cell to Time and will provide me
a time value that I can understand.

What I would like to do is have the results of the querry do it for me. Once
this is done I would ask for all values => 60 seconds

Any help is always welcomed.
 
What I would like to do is have the results of the querry do it for me. Once
this is done I would ask for all values => 60 seconds

Use a calculated field

Elapsed: DateDiff("s", [time 1], [time 2])

This will return an integer number of seconds elapsed between the two times.
Put a criterion on this field of >= 60.

John W. Vinson [MVP]
 
I have built a calculation in access that takes "time 2" - "time 1" and
provides a result of the lasped times. The expression gives back the answer.
It looks like

Expr1 0.00106481481634546

Now if I export it to Excel and format the cell to Time and will provide me
a time value that I can understand.

What I would like to do is have the results of the querry do it for me. Once
this is done I would ask for all values => 60 seconds

Any help is always welcomed.

Your formatting logic, I believe, is faulty.

The result of the Time difference should not be formatted as Time.
Time2 - Time1 = a number value (in minutes or hours or seconds) not a
time of day.
For example, in hours, #2:00 PM# - #1:00 PM# returns a result of 1,
not 1 PM.

To return the value is seconds use:
Expr1:DateDiff("s",[Time1],[Time2])

the above, using the time values above, will return a value of 3600.

To properly return values which are spread over 2 or more days, make
sure the fields includes the date as well as the time value.
 
T0_CallReceived T1_Notified Expr1
2007-Dec-30 7:46:19 PM 2007-Dec-30 7:46:35 PM 1.27314815472346E-04

Expresion

Expr1: [calldispatched]![T1_CallReceived]-[calldispatched]![T0_TimeZero]

How do I get 1.27314815472346E-04 to provide 16 Seconds


Thanks

I have built a calculation in access that takes "time 2" - "time 1" and
provides a result of the lasped times. The expression gives back the answer.
[quoted text clipped - 9 lines]
Any help is always welcomed.

Your formatting logic, I believe, is faulty.

The result of the Time difference should not be formatted as Time.
Time2 - Time1 = a number value (in minutes or hours or seconds) not a
time of day.
For example, in hours, #2:00 PM# - #1:00 PM# returns a result of 1,
not 1 PM.

To return the value is seconds use:
Expr1:DateDiff("s",[Time1],[Time2])

the above, using the time values above, will return a value of 3600.

To properly return values which are spread over 2 or more days, make
sure the fields includes the date as well as the time value.
 
T0_CallReceived T1_Notified Expr1
2007-Dec-30 7:46:19 PM 2007-Dec-30 7:46:35 PM 1.27314815472346E-04

Expresion

Expr1: [calldispatched]![T1_CallReceived]-[calldispatched]![T0_TimeZero]

How do I get 1.27314815472346E-04 to provide 16 Seconds

Thanks
What I would like to do is have the results of the querry do it for me. Once
this is done I would ask for all values => 60 seconds

Use a calculated field

Elapsed: DateDiff("s", [time 1], [time 2])

This will return an integer number of seconds elapsed between the two times.
Put a criterion on this field of >= 60.

John W. Vinson [MVP]
 
It works......thanks
What I would like to do is have the results of the querry do it for me. Once
this is done I would ask for all values => 60 seconds

Use a calculated field

Elapsed: DateDiff("s", [time 1], [time 2])

This will return an integer number of seconds elapsed between the two times.
Put a criterion on this field of >= 60.

John W. Vinson [MVP]
 
T0_CallReceived T1_Notified Expr1
2007-Dec-30 7:46:19 PM 2007-Dec-30 7:46:35 PM 1.27314815472346E-04

Expresion

Expr1: [calldispatched]![T1_CallReceived]-[calldispatched]![T0_TimeZero]

How do I get 1.27314815472346E-04 to provide 16 Seconds

Thanks
I have built a calculation in access that takes "time 2" - "time 1" and
provides a result of the lasped times. The expression gives back the answer.
[quoted text clipped - 9 lines]
Any help is always welcomed.

Your formatting logic, I believe, is faulty.

The result of the Time difference should not be formatted as Time.
Time2 - Time1 = a number value (in minutes or hours or seconds) not a
time of day.
For example, in hours, #2:00 PM# - #1:00 PM# returns a result of 1,
not 1 PM.

To return the value is seconds use:
Expr1:DateDiff("s",[Time1],[Time2])

the above, using the time values above, will return a value of 3600.

To properly return values which are spread over 2 or more days, make
sure the fields includes the date as well as the time value.

Why do you insist upon making life difficult for yourself when you can
simplify it using the built in Access DateDiff function as John and I
both suggested?

Fron the VBA debug window:
?datediff("s",#2007-Dec-30 7:46:19 PM#,#2007-Dec-30 7:46:35 PM#)
16

In a query, using your field names:
Expr1: DateDiff("s",[T1_CallReceived],[T0_TimeZero])
 
The database is a state database which I do not populate. That said I changed
the querry to what John and you have suggested. This is what returned

T0_TimeZero T1_CallReceived Elapsed
2007-Dec-30 7:48:06 PM 2007-Dec-30 7:49:38 PM -92
2007-Dec-30 1:49:30 AM 2007-Dec-30 1:50:51 AM -81
2007-Dec-30 2:23:44 AM 2007-Dec-30 2:24:45 AM -61
2007-Dec-28 9:40:45 PM 2007-Dec-28 9:41:52 PM -67
2007-Dec-24 7:33:53 PM 2007-Dec-24 7:34:55 PM -62
2007-Dec-10 10:42:59 AM 2007-Dec-10 10:43:06 AM -7
2007-Dec-01 8:06:50 PM 2007-Dec-01 8:06:59 PM -9

Why did - 7 and -9 show up? This also happens if I increase the criteria to
=> 75 seconds

T0_TimeZero T1_CallReceived Elapsed
2007-Dec-30 7:48:06 PM 2007-Dec-30 7:49:38 PM -92
2007-Dec-30 1:49:30 AM 2007-Dec-30 1:50:51 AM -81
2007-Dec-01 8:06:50 PM 2007-Dec-01 8:06:59 PM -9

How do I suppress it.

Thanks

T0_CallReceived T1_Notified Expr1
2007-Dec-30 7:46:19 PM 2007-Dec-30 7:46:35 PM 1.27314815472346E-04
[quoted text clipped - 28 lines]
Why do you insist upon making life difficult for yourself when you can
simplify it using the built in Access DateDiff function as John and I
both suggested?

Fron the VBA debug window:
?datediff("s",#2007-Dec-30 7:46:19 PM#,#2007-Dec-30 7:46:35 PM#)
16

In a query, using your field names:
Expr1: DateDiff("s",[T1_CallReceived],[T0_TimeZero])
 
The database is a state database which I do not populate. That said I changed
the querry to what John and you have suggested. This is what returned

T0_TimeZero T1_CallReceived Elapsed
2007-Dec-30 7:48:06 PM 2007-Dec-30 7:49:38 PM -92

Sounds like you have the arguments reversed. You should use

Elapsed: DateDiff("s", [T0_TimeZero], [T1_CallReceived])

in the calculated field.

-92 seconds is indeed less than +60 seconds, so the record is being retrieved
as you asked - just that it's as you *asked* instead of as you *wanted*! Pesky
literal minded computers! <g>

John W. Vinson [MVP]
 

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

Back
Top