Number rounding issue

D

Dave

Access 2003

Table has a field that is "Number" type and field size is set to Double

Data in that field in the table looks like this

40.750095
25.737315
-37.780793

I am trying to display that field on a form.
I am getting its value from the table using a coded dlookup on the "after
Update" event of another field in the table.

In the code I have dimmed the variable as Integer

On the form the field is formatted as fixed (but I also tried standard and
general)
6 decimal places

The value I am getting in the form field is
41.000000
26.000000
38.000000

So I clearly have some mismatch in "types" someplace to cause the rounding.

Can anyone help tell me how to get the exact value?

Any help here will be appreciated.

Thanks in advance
dave
 
F

fredg

Access 2003

Table has a field that is "Number" type and field size is set to Double

Data in that field in the table looks like this

40.750095
25.737315
-37.780793

I am trying to display that field on a form.
I am getting its value from the table using a coded dlookup on the "after
Update" event of another field in the table.

In the code I have dimmed the variable as Integer

On the form the field is formatted as fixed (but I also tried standard and
general)
6 decimal places

The value I am getting in the form field is
41.000000
26.000000
38.000000

So I clearly have some mismatch in "types" someplace to cause the rounding.

Can anyone help tell me how to get the exact value?

Any help here will be appreciated.

Thanks in advance
dave

re: > In the code I have dimmed the variable as Integer

By definition an Integer is a whole number (no decimal part).
Since the field you get the data from is Double, dim the variable as
Double.
 
D

Dave

That was it.

Thanks so much

dave

fredg said:
re: > In the code I have dimmed the variable as Integer

By definition an Integer is a whole number (no decimal part).
Since the field you get the data from is Double, dim the variable as
Double.
 

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