Print filtered records

  • Thread starter Thread starter Gina K
  • Start date Start date
G

Gina K

Hi All,

Sorry if this is a dumb question but I can't figure it out. I have a form
with a button that switches to a report for printing. So far, so good. If I
use Filter By Form to restrict the records returned on the form, is there a
way I can have my report show only the filtered records?

Thanks.
 
Hi All,

Sorry if this is a dumb question but I can't figure it out. I have a form
with a button that switches to a report for printing. So far, so good. If I
use Filter By Form to restrict the records returned on the form, is there a
way I can have my report show only the filtered records?

Thanks.

DoCmd.OpenReport "ReportName",acViewPreview, , Me.Filter
 
Hello Fred:

Sorry to jump into this thread, but I've been looking for the same answer
and found your suggestion.
DoCmd.OpenReport "ReportName",acViewPreview, , Me.Filter

I tried it and it worked, but it works when there are filtered records. When
there are no filtered records, my report produces only the partial records. I
have about 100 records in a table, but the report shows only about 40
records. I am wondering if you can give some advice.
Here is my code:
{starts}
Private Sub cmdPreview_Report_Click()
On Error Resume Next
Dim sCriteria As String
sCriteria = " 1 = 1 "
If FindCompany <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.CompanyName =
""" & FindCompany & """"
End If
If FindSize <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsSize =
""" & FindSize & """"
End If
If cboFilterFenestrated <> "" Then
sCriteria = sCriteria & " AND
Q_Biopsy_Product.JawsFenestrated = """ & cboFilterFenestrated & """"
End If
If FindProduct <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.ProductName =
""" & FindProduct & """"
End If
If FindVolume <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.JawsVolume =
""" & FindVolume & """"
End If
If FindLength <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.Length = """
& FindLength & """"
End If
If FindUsage <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.UsageArea =
""" & FindUsage & """"
End If
If cboFilterPE <> "" Then
sCriteria = sCriteria & " AND Q_Biopsy_Product.PE = """ &
cboFilterPE & """"
End If
DoCmd.OpenReport "T_Biopsy_Product", acPreview, , Me.Filter
End Sub
{ends}
 
Back
Top