Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Question Unanswered: Printing lables.

    Hi.

    When printing labels I need to print two labels where the field “NoItem” is 2 and three labels where “NoItem” = 3 and so on.
    The report is based upon a query of four tables (ITEM, color, producer and pattern)
    Can anyone help?

    Thanks.

    sincerely
    Vestigo

  2. #2
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239
    As I found other similar, unanswered, questions on this forum I had to find my own simple solution to this problem

    1
    Copy your report table “tc-ITEM” to a temporary table named “tmp-ITEM”

    2
    Remove any auto numbering and indexes in “tmp-ITEM”

    3
    Rebuild your report query to use table “tmp-ITEM” instead of “tc-ITEM”
    Remember to sort according to how you like to group your labels.

    3
    Create a “Print” button. On “On Click” enter the attached code


    Tadaaaaa
    Simple as that.

    Sincerely
    Vestigo

    Code:
    Private Sub Print_1_Click()
    Dim MaxNumber As iteger
    
        DoCmd.SetWarnings False
        
        MaxNumber = DMax("[Number]", "tc-ITEM")
        DoCmd RunSQL "DELETE [tmp-ITEM].* FROM [tmp-ITEM];"
            
        For I = 1 To MaxNumber Step 1     ' Set up 'MaxNumber 'repetitions.
            For J = 1 To I Step 1     ' Set up 'MaxNumber 'repetitions.
                DoCmd RunSQL "INSERT INTO [tmp-ITEM] ( Part_Number, EAN_Producer, EAN_ProdNo, EAN_Code, EAN_Check, Part_Description, ItemType_ID, Color_ID, Pattern_ID, [Size], [Number], In_Price, Out_Price, Export, Supplier_PartNumber, Season ) SELECT [tc-ITEM].Part_Number, [tc-ITEM].EAN_Producer, [tc-ITEM].EAN_ProdNo, [tc-ITEM].EAN_Code, [tc-ITEM].EAN_Check, [tc-ITEM].Part_Description, [tc-ITEM].ItemType_ID, [tc-ITEM].Color_ID, [tc-ITEM].Pattern_ID, [tc-ITEM].Size, [tc-ITEM].Number, [tc-ITEM].In_Price, [tc-ITEM].Out_Price, [tc-ITEM].Export, [tc-ITEM].Supplier_PartNumber, [tc-ITEM].Season FROM [tc-ITEM] WHERE ((([tc-ITEM].Number) = " & I & "));"
            Next J
        Next I
            
        DoCmd.SetWarnings True
        
        DoCmd.OpenReport "Rep-Clothes _Label", acViewPreview
    End Sub
    PS! Rebuild SQL insert query to fit your needs.
    Last edited by vestigo; 11-06-09 at 03:33.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •