0 Decimal places/round function.

R

Rob W

Greetings,

I have a subform based on a query that select data using aggregiate
functions i.e. min, max, average and standard deviation.
Some of these will return results with many decimal places.

The textboxes on the form have zero decimal places specified but it doesnt
seem to matter.
With the query designer I tried to use round to round them using 0 decimal
places i.e. Results: Round([Results],0) without success (syntax errors)

Im using access 2007, Im sure its very simple and im missing the obvious.
The field the aggregiate functions manipulate is a Number, field size
Integer.

Can anyone please assist.

Thanks
Rob
 
K

KARL DEWEY

You might try using a different alias like -- Final Results: Round([Results],0)

Or try Final Results: Results: Int([Results])
 
R

Rob W

I tried both :-

RoundedAVG: Avg(Int([Actualresult]))
and
RoundedAVG: Avg(Round[Actualresult],0))

and ensure the control source was RoundedAVG and it displayed 81.333 ..

Confused.


KARL DEWEY said:
You might try using a different alias like -- Final Results:
Round([Results],0)

Or try Final Results: Results: Int([Results])

--
KARL DEWEY
Build a little - Test a little


Rob W said:
Greetings,

I have a subform based on a query that select data using aggregiate
functions i.e. min, max, average and standard deviation.
Some of these will return results with many decimal places.

The textboxes on the form have zero decimal places specified but it
doesnt
seem to matter.
With the query designer I tried to use round to round them using 0
decimal
places i.e. Results: Round([Results],0) without success (syntax errors)

Im using access 2007, Im sure its very simple and im missing the obvious.
The field the aggregiate functions manipulate is a Number, field size
Integer.

Can anyone please assist.

Thanks
Rob
 
J

John W. Vinson

I tried both :-

RoundedAVG: Avg(Int([Actualresult]))
and
RoundedAVG: Avg(Round[Actualresult],0))

and ensure the control source was RoundedAVG and it displayed 81.333 ..

Confused.

Turn your expressions inside out. You're converting Actualresult to an
integer, and then averageing those integers; what you want to do is average
the values, and round that result. Try

Round(Avg([actualresult]), 0)
 
R

Rob W

Excellent, That worked and I understand why now.

:)

John W. Vinson said:
I tried both :-

RoundedAVG: Avg(Int([Actualresult]))
and
RoundedAVG: Avg(Round[Actualresult],0))

and ensure the control source was RoundedAVG and it displayed 81.333 ..

Confused.

Turn your expressions inside out. You're converting Actualresult to an
integer, and then averageing those integers; what you want to do is
average
the values, and round that result. Try

Round(Avg([actualresult]), 0)
 

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

Top