In the report Open I prompt the user for the number of places they want to show.
I then count the number of records in the Detail_Print
In the Detail_Format I check the number of records and when I reach the Places the user entered I set Cancel = true, But it doesn't stop if continues printing.
Expand|Select|Wrap|Line Numbers
- Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
- If VPlaces <> 0 Then
- If Me.txtcount > VPlaces Then
- Cancel = True
- End If
- End If
- End Sub
- Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
- txtcount = txtcount + 1
- End Sub
- Private Sub Report_Open(Cancel As Integer)
- stdmsg = "Show how many places. Enter 0 for complete list"
- VPlaces = InputBox(stdmsg, , 10)
- End Sub
Thanks