Z
zionsaal
I have a table "pt" with 2 fields 1 named "MasterID" and 1 named
"tickets"
each MasterID hes a number of tickets to print so I want to append to
a new table each masterid so many times the value of the ticket field
is
example if the masterid "15251" hes the ticket value 20 I want to
append to the new table the value "15251" 20 times
so I created a query "select tickets from pt group by tickets"
and the form runs the loop on each query record so many times the
value of me.tikets
then the first loop is to navigate to the next record
the docmd.gotorecord is default the next record if no one is
described
all works fine only I can't stop the loop when it reaches the end of
the query
thanks
here is the code:
Private Sub Command2_Click()
Dim i As Integer
i = 1
DoCmd.SetWarnings False
Do Until Me.RecordsetClone.EOF
i = 1
Do Until i > Me.tikets
DoCmd.RunSQL ("insert into 123 select masterid from pt where tikets =
'" & Me.tikets & "'")
i = i + 1
Loop
If Me.RecordsetClone.EOF Then
GoTo finish
Else
DoCmd.GoToRecord
End If
Loop
finish:
DoCmd.SetWarnings True
End Sub
the "Me.RecordsetClone.EOF" did not work
I got the massage "you can't go to specific record"
"tickets"
each MasterID hes a number of tickets to print so I want to append to
a new table each masterid so many times the value of the ticket field
is
example if the masterid "15251" hes the ticket value 20 I want to
append to the new table the value "15251" 20 times
so I created a query "select tickets from pt group by tickets"
and the form runs the loop on each query record so many times the
value of me.tikets
then the first loop is to navigate to the next record
the docmd.gotorecord is default the next record if no one is
described
all works fine only I can't stop the loop when it reaches the end of
the query
thanks
here is the code:
Private Sub Command2_Click()
Dim i As Integer
i = 1
DoCmd.SetWarnings False
Do Until Me.RecordsetClone.EOF
i = 1
Do Until i > Me.tikets
DoCmd.RunSQL ("insert into 123 select masterid from pt where tikets =
'" & Me.tikets & "'")
i = i + 1
Loop
If Me.RecordsetClone.EOF Then
GoTo finish
Else
DoCmd.GoToRecord
End If
Loop
finish:
DoCmd.SetWarnings True
End Sub
the "Me.RecordsetClone.EOF" did not work
I got the massage "you can't go to specific record"