Apply filter by form to a report from a tool bar button

Sergio

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

About my questión: "How to apply a filter by 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 to include this code an order criteria used by the filtered form?
-How to put this code on a tool bar button, instead command form button?

I appreciate any help.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom