Thanks very much rcmb for prompt reponse! Jeeva
Main Topics
Browse All TopicsRounding results of a division to 2 decimal places
I have the following lines of code in the body section of a web page which is displaying data from a database using the DateBase Results Wizard:-
<%
varDisplayAcres = fp_rs("plotarea")
varDisplayAcres = varDisplayAcres/4047
%>
I am wanting to display a plot area of land which is on an Access database in square metres, also as acres. This involves dividing by 4047 as a good enough approximation. I need the results to be displayed to only 2 decimal places
Here is an example of what I am having displayed at the moment:-
Plot area (sq.m.) = 590. Acres = approx 0.145787002718063
I want the acres to be shown as 0.15 for preference, although simple truncation to 3 decimal places, i.e. as 0.145 would be acceptable.
This is I am sure simple, but I am without any textbooks/manuals where I am working at the moment.
(I know how to do this using an Access query with the calculation and the acres embedded within the Access query, but in this case I want to do the calculation outside of Access, and within the displaying web page).
Thanks for assistance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: rcmbPosted on 2004-09-09 at 12:34:55ID: 12020477
Change your code to read as follows:
es,2)
<%
varDisplayAcres = fp_rs("plotarea")
varDisplayAcres = varDisplayAcres/4047
varDisplayAcres = formatnumber(varDisplayAcr
%>
where ,2 gives you the number of decimal places to show.
RCMB