set decimals in expression on dates

jedder18

Just Livin the Dream!
Local time
Yesterday, 22:03
Joined
Mar 28, 2012
Messages
135
Using Access 2007
Win 7


Total_Time: Format(nz(DateDiff("n",[Start],[End])/60))

This is my expression in a query.
I need to only show 2 decimal places in the results field.
HELP!
 
What do you think your Total_Time will look like?
I don't see what you are doing with Format
 
format the start and end times to number, allowing for blank or null

some answers will be 2.33366666
 
I think jdraw's point is that the Format() function takes two parameters. You are only passing it one.
 
Yes Mark that's the question re Format.

I think as long as Start and End are Date data type --and these are very poor choices for names -- that something like this (untested) should work.

Total_Time: Round((DateDiff("n",[Start],[End])/60),2)
 
Yeah, or if you do use Format() you can do . . .
Code:
Format(12.34567890, "0.00")
. . . but Format(), as far as I know, always returns a string, and if you want to round a number, you usually want a numeric result.
 
JDraw...I agree, the names are terrible. I'm working on an existing db of anothers' creation and too far in to change the names.

I edited this post....I forgot to put the Round function in...
this formula works...

Excellent. Thanks so much.
 

Users who are viewing this thread

Back
Top Bottom