Need Some Help Here Please

Milan

Registered User.
Local time
Today, 19:32
Joined
Feb 17, 2002
Messages
85
Hi People

I have a field that has decimal numbers. 1.5, 1.6, 1.7 1.3 and so on. However i need to test the decimal value and then either round down or up depending on the decimal value so for example,
if the record value was 1.7 in the first field and 1.8 in the 2nd field i want to round up the first record to 2 and round down the second record to 1.likewise if the first field is 1.4 and the second field is 1.6 round down the first and round up the second. I need to be able to test the decimal in the first field and then process the second field depending on this decimal value.

Any ideas here please!!!

Would Appriciate Any Help Here Please!!
:(
 
You were already given two solutions to this here - what was wrong with them?

If you didn't understand them you should have said, rather than posting again.

A little follow-up on how the solutions went wouldn't go astray either. ;)
 
The Previous solutions that were suggested have not worked!!. It was probably because i did not explain my self properly, hence re-posting the problem but this time explained a bit more clearly!. I could do with some help on this if poss!.

Milan
 
Using the CInt() function automatically rounds the number for you.

What are you doing with it that is not working?
 
i need to be able to test the decimal first!!!. and then decide to round!!!
how do i test for a decimal value!!
 
You could make a temporary string variable

i.e

x = 1.4

string = CStr(x)

so now string = "1.4"

Use the Instr() to find the decimal point

Using the value returned from the InStr() function, use the Mid() function

z = Mid(x, Instr(1, x, ".")+1, 1)

so z now equals = 4

evalueate as you want and then do what you have to with x
 
Hey!!

Thank you very much for that !. It Works perfect. I converted back to integer once i have tested the decimal value! . Nice to be able to get expert help when stuck in difficult situations!.

Thanks Again!

Milan
 
Thanks for that!! Also works fine!!!


Milan
 

Users who are viewing this thread

Back
Top Bottom