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?
bkpierceAsked:
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.

bchoorCommented:
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
bchoorCommented:
if that's not working, replace CInt by CDbl
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bkpierceAuthor Commented:
CDbl worked perfectly, thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.