F
Frank Tempelman
Hi all,
I have a database with about 350 records in it. I created a form
showing a list of these, with their most important attributes. Now I
can use the form's standard 'Filter by Selection' to show only the
records with a certain value for an attribute. So far, so good.
I also created a report. Clicking on the 'report' button on my form
prints the filtered records, and if no filter is applied, it prints
all records. Clicking the button activates the following procedure:
Private Sub Report_Click()
On Error GoTo Err_Report_Click
' get the list of IDs from the form's Recordset
Dim strFilter As String
strFilter = Me.Filter
DoCmd.OpenReport "rptRequirementList", , , strFilter
Exit_Report_Click:
Exit Sub
Err_Report_Click:
MsgBox Err.Description
Resume Exit_Report_Click
End Sub
and this all works very nicely. Except for a slight problem: if I
remove the filter (by right-clicking on the form and choosing 'Remove
Filter/Sort') the appropriate complete set of records is shown again.
But if I want to print all records now by clicking the report button,
in the report the old filter is still applied! If I want to print all
records before having applied a filter, everything is ok.
Can't find the solution. Should I additionally reset the filter
somewhere in the code, and how?
TIA
Frank Tempelman
I have a database with about 350 records in it. I created a form
showing a list of these, with their most important attributes. Now I
can use the form's standard 'Filter by Selection' to show only the
records with a certain value for an attribute. So far, so good.
I also created a report. Clicking on the 'report' button on my form
prints the filtered records, and if no filter is applied, it prints
all records. Clicking the button activates the following procedure:
Private Sub Report_Click()
On Error GoTo Err_Report_Click
' get the list of IDs from the form's Recordset
Dim strFilter As String
strFilter = Me.Filter
DoCmd.OpenReport "rptRequirementList", , , strFilter
Exit_Report_Click:
Exit Sub
Err_Report_Click:
MsgBox Err.Description
Resume Exit_Report_Click
End Sub
and this all works very nicely. Except for a slight problem: if I
remove the filter (by right-clicking on the form and choosing 'Remove
Filter/Sort') the appropriate complete set of records is shown again.
But if I want to print all records now by clicking the report button,
in the report the old filter is still applied! If I want to print all
records before having applied a filter, everything is ok.
Can't find the solution. Should I additionally reset the filter
somewhere in the code, and how?
TIA
Frank Tempelman