Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Report that needs to be filtered

Status
Not open for further replies.

carlp69

IS-IT--Management
Sep 23, 2003
157
GB
I have a report that opens from a button click with the following code :
Code:
Dim stDocName As String

    stDocName = "rpt_PO_Main"
    DoCmd.OpenReport stDocName, acNormal, , "PONumber = " & Me!PONumber

I want to email the same report directly from another button click, but when I apply the following code it returns all items and not just the ones where PONumber matches:
Code:
Dim stDocName As String

    stDocName = "rpt_PO_Main"
    DoCmd.SendObject acReport, stDocName, acFormatRTF, , , , "Purchase Order No. PO" & PONumber & ", " & PODesc & "."

How can I filter the SendObject command or is there an alternative way of doing this?

Carlp69
 
You could base your report on a query with
[tt]=Forms!frmForm!PONumber[/tt]
As one of the criteria, or you could use the report Open event to set a filter:
[tt]Private Sub Report_Open(Cancel As Integer)
Me.Filter = Forms!frmForm!PONumber[/tt]
Me.FilterOn = True
End Sub[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top