Filtering Report when using SendObject

G

Guest

Hello,

I'm trying to use the sendobject to e-mail a report that opens from several
diffeent plcaes so I need a filter when I send it so that it only shows the
correct information.

Can anyone help me?
 
A

Allen Browne

In a standard module (created through the Modules tab of the Database
window), in the General Declarations section (top of the module with the
Option statements), enter:
Public gstrReportFilter As String

In the Open event of your report, apply the filter based on this string, and
then clear it:
Private Sub Report_Open(Cancel As Integer)
If gstrReportFilter <> vbNullString Then
Me.Filter = gstrReportFilter
Me.FilterOn = True
gstrReportFilter = vbNullString
End If
End Sub

In the code that uses SendObject, set the filter string first:
gstrReportFilter = "[ClientID] = 99"
DoCmd.SendObject ...
 

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

Similar Threads


Top