469,071 Members | 1,922 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,071 developers. It's quick & easy.

About Devid

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

Please help urgent
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

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by eScrewDotCom | last post: by
220 posts views Thread by Brandon J. Van Every | last post: by
54 posts views Thread by Brandon J. Van Every | last post: by
8 posts views Thread by eScrewDotCom | last post: by
5 posts views Thread by eScrewDotCom | last post: by
reply views Thread by eScrewDotCom | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.