Which Format or Data Type

J

JustMe

Excuse the double post but I don't know which group to post to.

Could Someone PLease advise me on this?

I have a table with fields set.


FieldName Data Type Format Decimal Places Default Value
BASERATEAMT Currency Currency 5 0.07210
FLATCONNRATE Currency Currency 2 10.00
PWRCOSTRECOVER Curency Currency 7 0.0085000

My problem is when I enter what is supposed to be the default values
for these fields, suddenly they will NOT hold the values entered.

0.07120 becomes 0.0721
10.00 becomes 10
0.0085000 becomes 0.00850

I understand the last zeros are being droped but what steps would I use to
keep the zeros because these are used for computations in a total.

Would I use a text field and use quote marks to keep the zeros?
How would I then convert this to currency format for adding then togather
for a total sumation?

Thank you for assisting
 
R

Rick Allison

zeros are always removed when stored for numeric fields.

The calculation is always the same regardless of the value stored.

For example .0721 + .07211 = .14421 or five decimal places.

If, however, you added .0721 + .0123 = .0844 only four decimal places are
used. The extra zero is meaningless in the fifth position from a purely
mathematical point of view.

To display 5 places you will want to use Format perhaps to display the last
zero but I really question why. What value does it show other than there
are five level of precision.

I would not store "0.07210" in a text field. Too much conversion and
potential problems. Again, math is math regardless of the level of
precision, no decimals or 100 decimals.

That's what I would do.
 
T

TC

No problems "double posting" if you do this by "cross-posting". That is
where you send your post >once<, with >all< the relevant newsgroup names in
the Newsgroups: line of that one post. Cross-posting is fine, because
everyone (in one of the groups to which you posted) can see the replies you
got in the other groups.

But you have MULTI-posted. That is where you send the message seperatel;y,
to different newsgroups. Multi-posting is bad, because no-one can see the
replies you got in other groups. This means someone may waste their time
answering your post in one of those newsgroups, not knowing that you have
already received a reply in some of the others.

HTH,
TC
 
T

Tim Ferguson

0.07120 becomes 0.0721
10.00 becomes 10
0.0085000 becomes 0.00850

I understand the last zeros are being droped but what steps would I
use to keep the zeros because these are used for computations in a
total.

Apart from what I assume is a typo in the first line, these numbers are
identical. As a mathematician, I know that 10.00 is not the same thing as
10, but in computerland they are both represented by the same binary value.
The answer, therefore, is to relax about it.

To see the sig figs, you'll need the Format property of the text box set
right.

To calculate to the right precision, you need to make sure you are using
the right data type -- Double vs Single vs Integer. (Currency and Decimal
should be in that list somewhere, but I have yet to find a use for either
of them.)

No need to use Text fields -- in fact, it's probably a really bad idea.

Hope that helps


Tim F
 

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