quantity per package label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Projectnow
    New Member
    • Oct 2012
    • 13

    quantity per package label

    Hi,

    I have a form for inserting invoices, and on the subform I have a command button to print the labels, the label would contain the quantity of the product, so, for instance if the quantity is 11000 and package contains 2000 only so I have to print 5 labels with quantity 2000 and one label with 1000 qty what I need to do, is when I click the label cmd button to insert the records required to temp table to print the label

    I really appreciate any suggestion to accomplish this
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    #2
    in your routine

    1) divide the quantity by X / 2000 = Y
    2) take the integer (int) value of the result Z = int(Y)
    3) and subtract the int value "Z" from the original value "Y"
    4) test the result to see if it is equal to zero, if not add one to the original result.

    y = x / 2000
    z = int(y)
    if y - z == 0
    numLbl = y
    else
    numLbl = y+1

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      Easier Math Functions for Quotient and Remainder in Division

      what a hard way to do that.
      x\y = quotient only of the result of the division
      x mod y = the remainder of the of the division.

      So using the data in OP we have a total of 11000units.
      We can only have 2000units per package
      so we have 11000\2000 = 5 which is the number of whole packages
      and we have 11000 mod 2000 = 1000 which is the remaining units

      Use these functions within your loops to print your labels.


      Table of operators
      \ Round both numbers to integers, divide the first number by the second number, and then truncate the result to an integer.
      [Registered]\[Rooms]

      Mod Divide the first number by the second number, and then return only the remainder.
      [Registered] Mod [Rooms]

      Comment

      Working...