Originally Posted by
kid
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