Results 1 to 7 of 7
  1. #1
    kid is offline Novice
    Windows 10 Access 2007
    Join Date
    Jan 2020
    Posts
    20

    Label Cover Generation


    I want to generate cover labels:

    Concept: Each Cover has 6 Packets and Each packet has 12 books.

    I created a ABSTRACT table using entry form. Now I want update the COVER_DATA table,which helps to print COVER_DATA report the labels for the covers, using another form.

    Here I attached the file to play.cover.zip

  2. #2
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I updated your code - all of the variables were declared as Variant, except for "lastnumber", which was declared as an Integer. So I declared all of them as Integers.


    Quote Originally Posted by kid View Post
    Now I want update the COVER_DATA table,which helps to print COVER_DATA report the labels for the covers, using another form.
    I have no idea what this means. No explanation, no example and no data.

  3. #3
    kid is offline Novice
    Windows 10 Access 2007
    Join Date
    Jan 2020
    Posts
    20
    Sorry...

    Here I explain :

    I have another form to update the table COVER_DATA .

    From that form I get the variables of
    Cover Number Start,Last Cover Number ,
    Last Cover Packets, Last Packet Books.

    For Example

    Cover Number Start : 001
    Last Cover Number : 003
    Last Cover Packets : 04
    Last Packet Books : 07

    (these are fetch from ABSTRACT table)
    With these data,
    Now I want a query to update the COVER_DATA Table as following.

    Loop the Cover Start Number until Last Cover Number with Packet Numbers (01-06) and Book Numbers (01-12).
    For the Last Cover Number should stop at 04 with book number 01-07.

    CoverNumber PacketNumber BookStart Book End

    001 01 01 12
    001 02 01 12
    001 03 01 12
    001 04 01 12
    001 05 01 12
    001 06 01 12
    002 01 01 12
    002 02 01 12
    .
    .
    .
    .

    004 03 01 12
    004 04 01 07

  4. #4
    kid is offline Novice
    Windows 10 Access 2007
    Join Date
    Jan 2020
    Posts
    20
    Quote Originally Posted by kid View Post
    Sorry...

    Here I explain :

    I have another form to update the table COVER_DATA .

    From that form I get the variables of
    Cover Number Start,Last Cover Number ,
    Last Cover Packets, Last Packet Books.

    For Example

    Cover Number Start : 001
    Last Cover Number : 003
    Last Cover Packets : 04
    Last Packet Books : 07

    (these are fetch from ABSTRACT table)
    With these data,
    Now I want a query to update the COVER_DATA Table as following.

    Loop the Cover Start Number until Last Cover Number with Packet Numbers (01-06) and Book Numbers (01-12).
    For the Last Cover Number should stop at 04 with book number 01-07.

    CoverNumber PacketNumber BookStart Book End

    001 01 01 12
    001 02 01 12
    001 03 01 12
    001 04 01 12
    001 05 01 12
    001 06 01 12
    002 01 01 12
    002 02 01 12
    .
    .
    .
    .

    004 03 01 12
    004 04 01 07

    Here is My try... How do pass this loops into recordset


    Code:
    Private Sub Generate_Click()Dim cbStart As Integer
    Dim cbLast As Integer
    Dim lastCoverPacket As Integer
    Dim lastPacketBooks As Integer
    
    
    Dim x As Integer
    Dim y As Integer
    Dim z As Integer
    Dim a As Integer
    
    
    
    
    
    
    cbStart = Me.cbStart
    cbLast = Me.cbLast
    lastCoverPacket = Me.lastCoverPacket
    lastPacketBooks = Me.lastPacketBooks
    a = 1
    
    
    
    
    
    
    For x = cbStart To cbLast
        For y = 1 To 6
            
    
    
    MsgBox Format(x, "000") & "-" & Format(y, "00") & "-" & Format(a, "00") & "-" & Format(12, "00")
    
    
    If x = cbLast Then
        If y = lastCoverPacket Then
            
    
    
    MsgBox Format(x, "000") & "-" & Format(y, "00") & "-" & Format(a, "00") & "-" & Format(lastPacketBooks, "00")
    
    
    
    
           
        Exit For
    Exit For
    
    
            
        End If
    End If
    
    
    
    
    Next y
    
    
    
    
    Next x
    
    
    
    
    
    
    
    
    End Sub
    File attached
    Attached Files Attached Files

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Attached is a modified copy of your dB.

    It was very hard to follow because the names of the fields, the controls and the VBA code don't match.

    Even the example you posted doesn't match the data.

    Code:
    Cover Number Start : 001
    Last Cover Number : 003
    Last Cover Packets : 04
    Last Packet Books : 07
    
    CoverNumber    PacketNumber    BookStart    Book End
    001         01         01         12
    001         02         01         12
    001         03         01         12
    001         04         01         12
    001         05         01         12
    001         06         01         12
    002         01         01         12
    002         02         01         12
    .
    .
    .
    .
    
    004         03         01         12
    004         04         01         07 
    In your code, the "book end" (should be "Book_End") is hard coded to 12....??? And there is a variable "a" that is 1 and never changes??????


    Have a look at the dB......
    Attached Files Attached Files

  6. #6
    kid is offline Novice
    Windows 10 Access 2007
    Join Date
    Jan 2020
    Posts
    20
    Quote Originally Posted by ssanfu View Post
    Attached is a modified copy of your dB.

    It was very hard to follow because the names of the fields, the controls and the VBA code don't match.

    Even the example you posted doesn't match the data.
    I agreed with you. Hereafter I avoid those.

    However you did lot for me. My hearty thanks to you . With your code I made some alter according to my need.

  7. #7
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Happy to have helped. Good luck with your project...

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

Similar Threads

  1. Replies: 6
    Last Post: 10-10-2017, 03:01 AM
  2. Replies: 3
    Last Post: 10-08-2017, 12:53 PM
  3. Need help with report generation
    By sc2227 in forum Reports
    Replies: 4
    Last Post: 03-07-2017, 08:22 AM
  4. Replies: 1
    Last Post: 04-25-2014, 11:41 AM
  5. Replies: 3
    Last Post: 03-21-2013, 11:32 AM

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