Help with formatting decimal places in calculated query field

BJF

Registered User.
Local time
Today, 07:21
Joined
Feb 19, 2010
Messages
140
Hello,

I am having trouble getting the correct syntax to format a query field that is a calculation.

Please help!

This is my expression in my query field: the name of the field is 48 and the calculation is working correctly for me however there are like 10 decimal places and I want only 3.



48: ((36/48)*(([Yards]*36)*[Inches])/1296)



I have tried the following 2 ways below but still can’t get it into my query without a too many parenthesis error.



Format([48: ((36/48)*(([Yards]*36)*[Inches])/1296)], “0.000”)

48: Format(((36/48)*(([Yards]*36)*[Inches])/1296), “0.000”)



Thanks in advance for any assistance.

BJF
 
I should also note that the properties box does not work when i set the decimal value to 3 decimal places.
The properties box does not affect my calculated number at all no matter what i set it to.
 
the format function provides a text result - use the round function

48: round(((36/48)*(([Yards]*36)*[Inches])/1296))

and 48 is a dreadful name for a field - it will get you into trouble
 
If this works:

48: ((36/48)*(([Yards]*36)*[Inches])/1296)

Then you correctly added the format in the second version

48: Format( ((36/48)*(([Yards]*36)*[Inches])/1296) , "0.000")

So not sure why the second version didn't work.
 
the format function provides a text result - use the round function

48: round(((36/48)*(([Yards]*36)*[Inches])/1296))

and 48 is a dreadful name for a field - it will get you into trouble
Thanks so much CJ! I will change the filed name to text as well
 
I don’t recall having set a format in the query since formatting can easily be set in a control on a form or report.
 
The query gives you the result of the calculation: formatting should be done when that result is used.
 

Users who are viewing this thread

Back
Top Bottom