ClaraBarton
Registered User.
- Local time
- Today, 12:49
- Joined
- Oct 14, 2019
- Messages
- 451
On my main form I have filtered 9 records
In the General Declarations area I have
Then I have a parameter form called popPrint
Option Compare Database
Then my report:
The report has a query attached and insists on printing all 86 pages instead of the filtered 9 records.
If I remove the query it doesn't work either.
Where am I wrong?
In the General Declarations area I have
Code:
Option Compare Database
Option Explicit
Public rst9 As DAO.Recordset
Private Sub cmdReport_Click()
Set rst9 = Me.Recordset
'Debug.Print rst9.RecordCount returns 9 records
DoCmd.OpenForm "popPrint", acNormal
Me.Visible = False
cmdReport_Click_Exit:
Exit Sub
End Sub
Then I have a parameter form called popPrint
Option Compare Database
Code:
Option Explicit
Dim dbs As Database
Dim rst9 As DAO.Recordset
Private Sub Form_Open(Cancel As Integer)
Set dbs = CurrentDb
Set rst9 = Forms("splField").Recordset
End Sub
Private Sub btnCancel_Click()
DoCmd.Close
DoCmd.SelectObject acForm, "splField"
DoCmd.Restore
End Sub
Private Sub btnPrint_Click()
Dim strReport As String
'Debug.Print rst9.RecordCount also returns 9 records
Select Case Me.optPrint
Case 1 '45 Lines - pg break at lane
strReport = "rptField"
Case 2 '65 Lines - pg break at Lane
strReport = "2-rptField"
Case 3 '45 Lines - no pg break
strReport = "NoPBrptField"
Case 4 '65 Lines - no pg break
strReport = "NoPB2-rptField"
Case 5 '2 columns
strReport = "rpt2column"
End Select
DoCmd.OpenReport strReport, _
View:=acViewPreview
Me.Visible = False
End Sub
Then my report:
Code:
Option Compare Database
Private Sub Report_Open(Cancel As Integer)
Me.Recordset = rst9
End Sub
The report has a query attached and insists on printing all 86 pages instead of the filtered 9 records.
If I remove the query it doesn't work either.
Where am I wrong?
Last edited: