Control on report rounds to no decimals and I don´t know how fo fix it.

K

Kjell Harnesk

I have a report that has textboxes on it. These refer to controls on a form.
The boxes on the form has no control source, they are given it´s values by
code.
Often the control says for example 111,5 but the textbox on the report says
112.
In these cases, if I edit the control on the form and type in exactly what
was in it before
(in this case 111,5) the report works OK printing 111,5. (Comma is the
decimal separator in Sweden)
I can´t find any property that is diffrent when I compare the two. Can
anyone help me?
 
E

Evi

Format the control in the report using its Properties to Fixed with say 2
decimal places.
Evi
 
K

Kjell Harnesk

Evi said:
Format the control in the report using its Properties to Fixed with say 2
decimal places.


I have tried that already but the result is the same with fixed decimals as
with automatic.
I'm running Access from Office XP SP3 on a Vista OS if that matters.
This is very annoying.
 
R

Rick Brandt

Kjell said:
I have tried that already but the result is the same with fixed
decimals as with automatic.
I'm running Access from Office XP SP3 on a Vista OS if that matters.
This is very annoying.

Try using a ControlSource in your report that explicitly sets the data type.
Either CDbl() or CCur().

Unbound controls have no type so the report is (apparently) coercing them to
integers.
 
K

Kjell Harnesk

Rick Brandt said:
Try using a ControlSource in your report that explicitly sets the data
type. Either CDbl() or CCur().

Unbound controls have no type so the report is (apparently) coercing them
to integers.

Oops! The size of the control was not big enough to hold 4 digits plus the
comma so Access rounded it to 111. This is a little weird I think. It can
lead
to mistakes. It would be better to show just **** or the digits that fit in
the space
rather than rounding the number. Strange also that it showed the whole
number
when I edited it.

Anyway, thanks to Your tip I discovered this and it now works fine.
 

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