Set filter of form and then print report

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

Access 2000

I'd like to be able to set a filter on a from and click a button to print a
report based on the filtered records only.

Any ideas?

Thanks.
 
Put something like this into the Click event procedure of your command
button:

Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.FilterOn Then
strWhere = Me.Filter
End IF
DoCmd.OpenReport "Report1", acViewPreview, , strWhere
End Sub

If the form is performing filtering based on fields in the lookup tables of
the combos, you will need the matching tables in the RecordSource of your
report for that to work.
 
Excellent! Thanks!

Allen Browne said:
Put something like this into the Click event procedure of your command
button:

Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.FilterOn Then
strWhere = Me.Filter
End IF
DoCmd.OpenReport "Report1", acViewPreview, , strWhere
End Sub

If the form is performing filtering based on fields in the lookup tables of
the combos, you will need the matching tables in the RecordSource of your
report for that to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top