Log in

View Full Version : A Question



kbsudhir
08-06-2009, 10:47 AM
Hi All,

I have a question.

Is it possible to calculat time in negative in Access..??Ex. "1:00:00" - "1:30:00"

The reason is I have created a Access tool which captures break for my team members. They allowed to have 1Hr break.

My tool in Access 2003 deducts the break duration already used with the total duration allowed & shows the remaining duration in access form using a graph. Graph pulls the data from a query.

But there are scenarios where the break duration is more than the allowed duration.
Now in this case excess the duration should be displayed in negative.
Ex. "1:00:00" - "1:30:00" i.e "-00:30:00".

Is this possible..?? If Yes, how to go about doing this.
If No, Is there any other way?

:think: :think:

Please Guide.

Regards
Sudhir

hansup
08-06-2009, 01:34 PM
Now in this case excess the duration should be displayed in negative.
Ex. "1:00:00" - "1:30:00" i.e "-00:30:00".
You can use the DateDiff function to return a negative duration between two time values. For example, this expression will produce -30:

DateDiff("n", #1:30:00#, #1:00:00#)

Look at help for DateDiff to see what other units you can use for the interval (the function's first argument).

If you want the duration formatted as -00:30:00, you'll have more work to figure out how to build that transformed value.

Good luck,
Hans

kbsudhir
08-10-2009, 06:37 AM
Thanks Hans, For the guidance