469,071 Members | 1,922 Online

I have a feild named "Net weight" for Kgs. When I devid it with 40. Answer shows in desimal. I wanna spirite stuffs as Mands and kgs. Example as

12100/40= 302.5

But i want that

302 Mands and 20 kgs
Dec 4 '09 #1

#### ✓ answered by Sajid Saeed

I had picked my mistake. Its was a fatal error. Its made very changing. So thanks for it.

5 1299
You can use the Mod operator. This will give you the remainder of the division of any two numbers.
Expand|Select|Wrap|Line Numbers
1. dim intRemainder as Integer
2. dim intIntegerPart as Integer
3.
4. intRemainder = 12100 Mod 40
5. intIntegerPart = 12100 \ 40
intRemainder will now be holding 20 which is the remainder of the calculation.
intIntegerPart will then be holding 302 which is the integer part of the answer, make sure you use the right slash as it is the opposite direction of the normal division symbol.

Hope this helps,
Devo
Dec 4 '09 #2
Thanks for help,

I have used your method. I have found best result. But there is one more problem. When I divide it 12100/40 its shows me mands in decimal. But i wanna that without decimal. As

12100/40= 302.5

But can i get that result in this method

12100 Mod 40 answer looked as 302-20

Dec 5 '09 #3
ssnaik84
149 100+
I do not know much about MS Access, but, each database or programing language has Ceil and Floor functions..
Ceil - rounds value to upper value e.g. 302.5 => 303 and
Floor - rounds value to lower value e.g. 302.5 => 302

try to use it.. e.g
Expand|Select|Wrap|Line Numbers
1.
2. Floor(12100/40) mands and (((12100/40) - Floor(12100/40)) * 40) kg
3.
4.
Dec 5 '09 #4
missinglinq
3,532 Expert 2GB
If you'd paid attention to sirdevo's post

"intIntegerPart = 12100 \ 40"

"make sure you use the right slash as it is the opposite direction of the normal division symbol."

perhaps you'd have more success! The right or backward slash, as demonstrated previously, returns the integer part of the calculation without the decimal part!

Linq ;0)>
Dec 5 '09 #5
I had picked my mistake. Its was a fatal error. Its made very changing. So thanks for it.
Dec 6 '09 #6