i click a command button and it prints a report...it then goes to the next record and prints that report.
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
now instead of pasting the code 184 more times (thats how many records there are) can i add to the code so that it knows how many records there are and when it gets to the end it stops
the complete code is this
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Screen.PreviousControl.SetFocus
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
----repeat---184 times
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
now instead of pasting the code 184 more times (thats how many records there are) can i add to the code so that it knows how many records there are and when it gets to the end it stops
the complete code is this
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Screen.PreviousControl.SetFocus
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
DoCmd.GoToRecord , , acNext
DoCmd.OpenReport "GUI spec 2", acNormal, , "[GUI ID] = " & Me.[Text16]
----repeat---184 times
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub