Results 1 to 4 of 4
  1. #1
    doshpra is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    2

    How to print multiple copies of a multiple records in a single report

    Hi!



    I am beginner in MS Access and need assistance in printing multiple copies of different labels in a single report. I have a huge list of 2000 products and need to print out shipping labels of different products as per varying requirement in a single report. eg. if I need to print twenty nos. of labels of Product No. 5 (Prd 5) & six nos. of Product No. 44 (PRD 44) & thirty nos. of Product No. 200 (Prd 200) & so on depending on the requirement in single report and next time the quantity may vary as per the different requirement.

    Is there a simple method wherein I can design a simple sheet / form/ query or simple VBA code (have no knowlegde of VBA!) and just put in the number of labels of required of a particular in a field box against the product name(s) and those particular products (names) are printed in a single report as per specified quantity?

    Sample of the database is as follows:

    ID ProductName
    1 Prd 1
    2 Prd 2
    3 Prd 3
    . .
    . .
    2000 Prd 2000

    Any help in this regard will be highly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    There is no simple and intrinsic method to accomplish that.

    I do what you describe with VBA code that writes duplicate records to a 'temp' table. The specified quantity field could be used by the code to determine how many duplicate records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    doshpra is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    2
    Thanks June7, Could you help me with the code to do print the required number of multiple records.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Create field in Products table for the record count.

    If you want to allow users to manually change the quantity but not overwrite the default, create another field in the table and populate it same as the first. Present the second field to user in a form to overwrite value. Use that second field in the procedure.

    Create a table to serve as the temporary repository of label records. Adjust code for whatever fields you want.

    Code like:

    Sub btnPrintLabels_Click()
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    CurrentDb.Execute "DELETE FROM temptablename"
    rs.Open "SELECT * FROM Products;", cn, adOpenStatic, adLockPessimistic
    While Not rs.EOF
    For i = 1 to rs!LabelCount 'or LabelCount2
    CurrentDb.Execute "INSERT INTO temptablename(ProductName) VALUES('" & rs!ProductName & "'"
    Next
    rs.MoveNext
    Wend
    DoCmd.OpenReport "Labels"
    CurrentDb.Execute "UPDATE Products SET LabelCount2=LabelCount;"
    End Sub

    Use of ADODB recordset will require VBA reference to Microsoft ActiveX Data Objects 2.8 Library.

    I just remembered this question has been asked and answered. There is another code method that doesn't require temp table. Review https://www.accessforums.net/reports...ord-37535.html

    Going to try and eliminate use of temp table for this process. I have variable count also so will be interesting.
    Last edited by June7; 02-04-2014 at 07:05 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-08-2012, 01:03 PM
  2. Create Multiple Records from Single Form
    By mcktigger in forum Forms
    Replies: 17
    Last Post: 09-15-2011, 11:07 AM
  3. Creating multiple records from a single form
    By secretary in forum Forms
    Replies: 8
    Last Post: 07-18-2011, 04:03 PM
  4. Multiple records on a single page
    By neo651 in forum Forms
    Replies: 1
    Last Post: 06-29-2011, 10:21 PM
  5. Replies: 8
    Last Post: 01-21-2011, 10:28 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums