form rounding off decimals

G

Guest

I have a form containing numerous numeric fields. The fields in both the
underlying table and in the form itself are formatted to general number with
the decimals formatted to one. In spite of this, however, the form rounds
off the decimals. I'm wondering what's causing this and how I can stop it.
 
J

John Vinson

I have a form containing numerous numeric fields. The fields in both the
underlying table and in the form itself are formatted to general number with
the decimals formatted to one. In spite of this, however, the form rounds
off the decimals. I'm wondering what's causing this and how I can stop it.

Almost certainly, it's the datatype of the number fields in the Table.

Open the table in design view and select one of the fields. Look in
the lower left corner of the screen - is the number a Long Integer
datatype, the default? If so, *it is an Integer* - by definition, a
whole number. The format and the decimals properties don't change the
fact that *it is an integer*.

If you can get by with four (exactly four, no more no fewer) decimals,
use a Currency datatype rather than a Number datatype (again, this
isn't the Format property, but the datatype on the same line of the
design grid as the fieldname); if you need more decimals, and can
tolerate some roundoff error, use a Float or Double size number
instead of the Long Integer.

John W. Vinson[MVP]
 
G

Guest

I used the Decimal datatype (if you're talking about the Field Size
property). I've tried single and double, as well, though, with no change in
the results.
 
J

John Vinson

On Wed, 26 Jul 2006 12:40:02 -0700, hbear

Now that's really odd! I've seen this error innumerable times, but
it's always been because the user used the default Long Integer
datatype.

If you open the table datasheet directly, can you enter numbers past
the decimal? How about the Query upon which the form is based? Do you
have any VBA code (say in the BeforeUpdate or AfterUpdate events) on
the textboxes which are truncating the number? or do the textboxes
have a Format or Input Mask property which might be hiding the
decimals?
I used the Decimal datatype (if you're talking about the Field Size
property). I've tried single and double, as well, though, with no change in
the results.


John W. Vinson[MVP]
 
G

Guest

Don't know what happened, but I brought the file home on my flash drive and
suddenly I have decimals.
 

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