Too many numbers

  • Thread starter Thread starter LMB
  • Start date Start date
L

LMB

Here is an expression I have in a query. I want it to only show the answer in this format 22.30, not 22.3333333. What do I need to add to stop the excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Thanks,
Linda
 
Linda,

Expr1: Format([SumOfWorkAreaHours]/12, "#.00")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Here is an expression I have in a query. I want it to only show the answer
in this format 22.30, not 22.3333333. What do I need to add to stop the
excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Thanks,
Linda
 
Here is an expression I have in a query. I want it to only show the answer in this format 22.30, not 22.3333333. What do I need to add to stop the excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Try using the Round() function:

Expr1: Round([SumOfWorkAreaHours]/12, 2)


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
I'd have to agree with John that a Round() is in order. It's better
to leave it numeric rather than make it a string in case you decide to
base some other query on it, perhaps using the number in calculations.
Format() makes a a string.

But can you explain why you want a value that begins 22.33 to display
as 22.30?

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
I would love it to show 22.30 but I was going to be happy with 22.33. How do I get it to round to 22.30 instead? John's worked in both my query and the crosstab query that is based on the 1st query so I will be using the Round function.

Thanks,
Linda
I'd have to agree with John that a Round() is in order. It's better
to leave it numeric rather than make it a string in case you decide to
base some other query on it, perhaps using the number in calculations.
Format() makes a a string.

But can you explain why you want a value that begins 22.33 to display
as 22.30?

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Here is an expression I have in a query. I want it to only show the answer in this format 22.30, not 22.3333333. What do I need to add to stop the excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Try using the Round() function:

Expr1: Round([SumOfWorkAreaHours]/12, 2)


John W. Vinson[MVP]

****************
Thanks John. That worked for my query and also for the crosstab query I created based on this query.

Linda
 
Hi Graham. This worked perfectly but when I made a crosstab query based on this query, I got this error..."Data type mismatch in criteria expression" I don't know what that means but the suggestion by John worked for both.

Thanks,
Linda
Linda,

Expr1: Format([SumOfWorkAreaHours]/12, "#.00")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Here is an expression I have in a query. I want it to only show the answer
in this format 22.30, not 22.3333333. What do I need to add to stop the
excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Thanks,
Linda
 
The other post isn't here yet but I figured it out...I replaced the 2 with a 1....I must be a genius and I guess I am going to be a "real developer" someday. <g>

Linda
I'd have to agree with John that a Round() is in order. It's better
to leave it numeric rather than make it a string in case you decide to
base some other query on it, perhaps using the number in calculations.
Format() makes a a string.

But can you explain why you want a value that begins 22.33 to display
as 22.30?

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Dear Linda:

It sounds like you may want to round to 1 decimal place in the query,
then display to two places in a form or report. Rounding to 22.3 and
rounding to 22.30 is exactly the same thing. That is, it is one thing
what the number is, and quite another how you display it. Obviously
22.3 and 22.30 are identical values when considered as an internal
numberic representation. The difference is in how you choose to
format it for display.

It is a good thing to separate in your mind the concept of the value
of a number and the way you want to display it. These really are
quite separate.

Rounding can change the value of the number inside the computer.
Formatting does not change the value of the number, but only how we
see it. It's a substance / perception kind of difference. To be
successful in working with computers, it's a good thing to know the
difference.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts


I would love it to show 22.30 but I was going to be happy with 22.33. How do I get it to round to 22.30 instead? John's worked in both my query and the crosstab query that is based on the 1st query so I will be using the Round function.

Thanks,
Linda
I'd have to agree with John that a Round() is in order. It's better
to leave it numeric rather than make it a string in case you decide to
base some other query on it, perhaps using the number in calculations.
Format() makes a a string.

But can you explain why you want a value that begins 22.33 to display
as 22.30?

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts


Here is an expression I have in a query. I want it to only show the answer in this format 22.30, not 22.3333333. What do I need to add to stop the excessive decimal places?

Expr1: [SumOfWorkAreaHours]/12

Thanks,
Linda
 
Back
Top