Objective:
1. I now have a total of eight 1 page reports: (RM_Page_1, RM_Page_2,RM_Page_3...etc)
2a. I want to be able to select a button to print all eight reports based on the current record appearing on my form.
2b. I also want to be able to filter all the records based on several criteria, and then print all 8 reports (collated) for each record that matches the selected criteria.
Here's the code and what it does/is doing:
I've shortened it to 3 reports for testing)
The "On Click" event of my button code:
*****************************************
Private Sub Command378_Click()
On Error GoTo Err_Command378_Click
Call CollReports2(5, "RM_Page_1", "RM_Page_2","RM_Page_3"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Exit_Command378_Click:
Exit Sub
Err_Command378_Click:
MsgBox Err.Description
Resume Exit_Command378_Click
End Sub
*****************************************
In the above code - I'm not certain of how to modify the (5, or exactly what that number really does. It is supposed to set the maximum number of pages in each report, which now is only 1, but if I choose 1, only 1 record will print...
The Module Code:
******************************************
Function CollReports2(NumPages, RM_Page_1 As String, RM_Page_2 As String, RM_Page_3 As String)
Dim MyPageNum As Integer
' Set the page number loop and alternate printing the report pages.
For MyPageNum = 1 To NumPages
' NumPages is the number of pages to print.
DoCmd.SelectObject acReport, RM_Page_1, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, RM_Page_2, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, RM_Page_3, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
Next MyPageNum
End Function
************************************8
1st question. Although this works, each report requeries the data so that if I try to put a criteria "Like" expression into the query I have to input the parameter 8 times, how can I fix that so that the dialog will only appear once and then complete the print job?
2nd Question. What do I need to insert into the code in order to print the 8 reports for the current record appearing on the form?
Thanks to any and all suggestions...
1. I now have a total of eight 1 page reports: (RM_Page_1, RM_Page_2,RM_Page_3...etc)
2a. I want to be able to select a button to print all eight reports based on the current record appearing on my form.
2b. I also want to be able to filter all the records based on several criteria, and then print all 8 reports (collated) for each record that matches the selected criteria.
Here's the code and what it does/is doing:
I've shortened it to 3 reports for testing)
The "On Click" event of my button code:
*****************************************
Private Sub Command378_Click()
On Error GoTo Err_Command378_Click
Call CollReports2(5, "RM_Page_1", "RM_Page_2","RM_Page_3"
Exit_Command378_Click:
Exit Sub
Err_Command378_Click:
MsgBox Err.Description
Resume Exit_Command378_Click
End Sub
*****************************************
In the above code - I'm not certain of how to modify the (5, or exactly what that number really does. It is supposed to set the maximum number of pages in each report, which now is only 1, but if I choose 1, only 1 record will print...
The Module Code:
******************************************
Function CollReports2(NumPages, RM_Page_1 As String, RM_Page_2 As String, RM_Page_3 As String)
Dim MyPageNum As Integer
' Set the page number loop and alternate printing the report pages.
For MyPageNum = 1 To NumPages
' NumPages is the number of pages to print.
DoCmd.SelectObject acReport, RM_Page_1, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, RM_Page_2, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
DoCmd.SelectObject acReport, RM_Page_3, True
DoCmd.PrintOut acPages, MyPageNum, MyPageNum
Next MyPageNum
End Function
************************************8
1st question. Although this works, each report requeries the data so that if I try to put a criteria "Like" expression into the query I have to input the parameter 8 times, how can I fix that so that the dialog will only appear once and then complete the print job?
2nd Question. What do I need to insert into the code in order to print the 8 reports for the current record appearing on the form?
Thanks to any and all suggestions...