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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View time in quarter hours 1

Status
Not open for further replies.

beansmom

Programmer
Aug 24, 2004
35
US
I have a calculated field in a query:

HoursMins: Format(Int([TimeOn]-[TimeOff]),"0\:") & Format([TimeOn]-[TimeOff],"Short Time")

It returns:

Time On Time Off HoursMins
1/3/2003 6:00:00 PM 1/3/2003 4:45:00 PM 0:01:15

My problem is that my user is now asking the HoursMins field display the minutes as quarters. For example, 1:25 (1 and a quarter hour), instead of 1:15 (1 hour and 15 minutes). She also needs it to round to the nearest quarter. For example, 1:25 would be 1:50.

Thanks for your assistance.
 
You can use an expression like:
HoursDecRoundedToQrtrs:Cint(DateDiff("n",#1/3/2003 4:45:00 PM#,#1/3/2003 6:00:00 PM#)/15)/4

This properly places a period where your user asked for a colon. I would push for displaying the period to avoid confusion.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top