# SQL Reporting convert to integer

I have a report in SQL Reporting that is pretty simple. It does some simple calucalations. One of them is to subtract an estimated total hours from actual labor hours on projects. The estimated total hours does not alwasy have an entry so the syntax is set to display zero if nothing is there.

Box 1: =IIF(IsNothing(Fields!User_Define_1.Value), 0, Fields!User_Define_1.Value)
Box 2: =Fields!Act_Labor_Units_TTD.Value
Box 3: =(CInt(Fields!User_Define_1.Value))-Fields!Act_Labor_Units_TTD.Value

The User_Define_1 field is a text field so to do the calculation I had to convert it to integer.

My problem is this, some of the calculations are not coming out right, it seems to be off by 0.25 on some of them. For  example on one project Box 1 has 64.75 and box 2 has 66. Box three should say -1.25 but instead it says -1.00

I have a feeling it's rounding them off (maybe during the conversion to integer?) isr there any additional syntax I should be using with the Cint to keep it at 2 decimals instead of more?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
The CInt in box 3 is converting to integer so basically round off. 64.75 is becoming 65, that's why you have 1. So use 2 alternatives I can think of:

1. Box 3: IIF(IsNothing(Fields!User_Define_1.Value), 0, Fields!User_Define_1.Value) - Fields!Act_Labor_Units_TTD.Value

2. Box 3: [Box 1 Name].Value - Fields!Act_Labor_Units_TTD.Value
where [Box 1 Name] is the [id] of the textbox

HTH ~BC

0
Commented:
if that's not working, replace CInt by CDbl
0

Experts Exchange Solution brought to you by