Cannot edit decimals after a query!! Help!

B

Bryan

Hi
After I run a query, I get very long decimals displayed. How can I adjust
them to only 2? Even when I go into properties, it will not allow me to
chance them.

Also, my orignial numbers fields that I am querying only have 2 decimal
points, but my query result table has 15.

Any ideas?

Thanks
 
J

John Vinson

Hi
After I run a query, I get very long decimals displayed. How can I adjust
them to only 2? Even when I go into properties, it will not allow me to
chance them.

Also, my orignial numbers fields that I am querying only have 2 decimal
points, but my query result table has 15.

Any ideas?

Thanks

Use the Round() function:

CalcField: Round(<expression>, 2)

John W. Vinson[MVP]
 
B

Bryan

Could you please explain a little bit more? I don't see where to do that. Is
that something I need to set up before I run the query, or can it be done in
the query result table after it is run?

Thank you very much!
 
T

Tim Ferguson

After I run a query, I get very long decimals displayed. How can I
adjust them to only 2?

Change the query from

SELECT MyTotal / MyNumber AS MyAverage,
etc, etc
FROM etc

to

SELECT FORMAT(MyTotal / MyNumber, "0.00") AS MyAverage
etc, etc
FROM etc

Using a jet database, Format is a recognised function. It's one of a
number of vb functions that are available to the db engine. Not all
functions are: it's usually worth experimenting to find out.

Hope that helps


Tim F
 
J

John Vinson

Could you please explain a little bit more? I don't see where to do that. Is
that something I need to set up before I run the query, or can it be done in
the query result table after it is run?

Thank you very much!

I have NO idea what kind of calculation you're doing. My suggestion
was that you enclose that calculation - whatever it is, I don't know,
I can't see it - in a call to Round().

You can (and should) base a Form for onscreen viewing, or a Report for
printing, on your query, rather than using the query datasheet; you
can bind this calculated field to a textbox on the form or report, and
set that textbox's Format property to (say) #.00 to give you exactly
two decimal places.

John W. Vinson[MVP]
 

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