Link to home
Start Free TrialLog in
Avatar of jbrown0828
jbrown0828

asked on

programatically print multiple pallet labels that are numbered sequentially

I would like to programatically print multiple pallet labels with the same item information that are numbered sequentially. The amount of labels will be based on a calculation in the form. Example… if there are 100000 items and each pallet contains 10000 then the number of pallets is 10 so there would be 10 labels printed with the first having “1” at the bottom and the last having "10" at the bottom. As usual it's urgent. Thanks, Jim
Avatar of PapaLorax
PapaLorax

How are you printing the labels? Is there code behind a button? You should be able to run a calculation then run a loop where an unbound field prints Page X and Y. If you let me know what code fires the printing I can give you an example.
Avatar of Jim Dettman (EE MVE)

  Are you doing UCC128 labeling?  Simple setup is to use code in the reports detail band OnFormat event to increment a counter and push the value into the needed controls.

  More sophisticated would be to setup tables with one record per label.  Code would be written to populate the table(s).  The label then would just be a "normal" report that would print off that.

JimD
Avatar of jbrown0828

ASKER

To answer both papalorax and jimd's questions...papalorax...the code behind the print button is currently just onclick Do.Cmd.PrintOut. The unbound field is just a calculation of 2 fields quantity/quantity_per_pallet . JimD...There will be some barcoding later but for now all I need is the sequential numbering and I have considered doing a make table query to populate a table with this data but was hoping there would be a simpler "coded" way from the original form's printout command. Thanks to both of you for your quick response
<<JimD...There will be some barcoding later but for now all I need is the sequential numbering and I have considered doing a make table query to populate a table with this data but was hoping there would be a simpler "coded" way from the original form's printout command. >>

  Might want to go with the make table then.  Even if you just empty the table between label runs.  That will set you up for the future.

  From the output command itself you can't do anything, but in the report, you can do this:

1. In the declarations section, dim a counter:

   Dim lngLabelCount as long
   
2. In the OnFormat event of the Detail band do:

  If FormatCount = 1 then
     ' Add one to the label count
     lngLabelCount = lngLabelCount + 1
    If lngLabelCount >   <max labels> then
        DoCmd.Close
    Else
       Me![<my label count control>] = lngLabelCount
       Me.PrintSection =  True
       Me.MoveLayout = True
       Me.NextRecord = False
    End If
  End If

  <max labels> is a value you need to pass in either in a memory variable or as part of openargs (A2003 and up).

  The above assumes one record is available, which it will repeat over and over until the label count is reached.

JimD
Thanks Jim for the "labelcount" idea but your original conclusion about developing a temporary table seems to be the best way to deal with this. The final product will have the item number and its respective pallet number concatenated into a barcode, which as far as I know could not be accomplished in a report label without that data coming from a table. So I guess my next task is to figure out how to create a make table query that will duplicate a record the appropriate number of times and get around the lack of "autonumbering"
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks JimD, I wrote it in code and that will do the trick. Thanks for the advice about not being able to accomplish this from the output command. I guess I was too stubborn about simplifying when I should have just knuckled down.