How to apply the same filter ... (second part)

Sergio

Registered User.
Local time
Today, 16:15
Joined
Feb 28, 2002
Messages
42
Hello!

About my last post: "How to apply the same filter used by a form to a report"

I found this code from KKilfoil registered user of Access World Forums:

Private Sub PreviewMeterReport_Click()
On Error GoTo Err_PreviewMeterReport_Click

Dim stDocName As String

stDocName = "Meter Report"
If Me.FilterOn Then
DoCmd.OpenReport stDocName, acPreview, , Me.Filter
Else
DoCmd.OpenReport stDocName, acPreview
End If

Exit_PreviewMeterReport_Click:
Exit Sub

Err_PreviewMeterReport_Click:
MsgBox Err.Description
Resume Exit_PreviewMeterReport_Click

End Sub


This code works ok for me, but I have a couple of questions:

  • How can I include to this code an order criteria used by the filtered form?
  • How can I put this code on a tool bar buton?

I appreciate any help.

Thanks.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom