About Devid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sajid Saeed
    New Member
    • Dec 2009
    • 7

    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
  • sirdevo
    New Member
    • Nov 2009
    • 9

    #2
    You can use the Mod operator. This will give you the remainder of the division of any two numbers.
    Code:
    dim intRemainder as Integer
    dim intIntegerPart as Integer
    
    intRemainder = 12100 Mod 40
    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
    Last edited by Frinavale; Dec 4 '09, 05:16 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.

    Comment

    • Sajid Saeed
      New Member
      • Dec 2009
      • 7

      #3
      Problem About decimal in feild of form

      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

      Comment

      • ssnaik84
        New Member
        • Aug 2009
        • 149

        #4
        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
        Code:
        Floor(12100/40) mands and (((12100/40) - Floor(12100/40)) * 40) kg

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          If you'd paid attention to sirdevo's post

          "intInteger Part = 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)>

          Comment

          • Sajid Saeed
            New Member
            • Dec 2009
            • 7

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

            Comment

            Working...