sprinklerhead
Technical User
I used this code and it worked, but now I need to change [Roll Number] and [txtEnd] to a letter ie. A B C etc... and don't know how to do the loop. Could someone please explain?
Code:
Private Sub cmdPrint_Tickets_Click()
On Error GoTo Err_cmdPrint_Tickets_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Do Until [Roll Number] = [txtEnd] + 1
If optP1 = -1 Then
DoCmd.OpenReport "rptTicketP1", acViewPreview, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP2 = -1 Then
DoCmd.OpenReport "rptTicketP2", acViewPreview, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP3 = -1 Then
DoCmd.OpenReport "rptTicketP3", acViewPreview, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP4 = -1 Then
DoCmd.OpenReport "rptTicketP4", acNormal, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP5 = -1 Then
DoCmd.OpenReport "rptTicketP5", acNormal, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP6 = -1 Then
DoCmd.OpenReport "rptTicketP6", acNormal, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP7 = -1 Then
DoCmd.OpenReport "rptTicketP7", acNormal, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
If optP8 = -1 Then
DoCmd.OpenReport "rptTicketP8", acNormal, "", "[IndexNo]=[Forms]![frm9].[IndexNo]"
End If
[Roll Number] = [Roll Number] + 1
Exit Do
Loop
Exit_cmdPrint_Tickets_Click:
Exit Sub