Automate Sending a filtered Report as an Attachment to an Outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am currently building an application that tracks a process improvement
program. One of the functions I want to create is the ability to create and
then assign an assessment to personnel. I have already created the report
that is in whole the assignment document and form used to perform the
assessment. Instead of simply emailing the form, I would like to attach it
to an Outlook Task Request to aid tracking for both the program coordinator
and assigned personnel. I have been able to use automation to create and
send the Task Item. I am having a lot of trouble attaching the filtered
report. Although I know it may simplify the process, I do not wish to save
copies of the report. I wish form them to stay dynamic and not have to
maintain version control. Can anyone help?
 
A simple way to fire off a report is with SendObject.

But the core of your issue is the filtering of the report? Create a public
string variable to specify the filter, and apply it to the Filter of the
report in its Open event.

In a standard module:
Dim gstrReportFilter As String

In the Open event of your report:
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 click event of the button that opens your report:
gstrReportFilter = "ID = 999"
DoCmd.SendObject acSendReport, "Report1", ...
 
Thanks Mr Browne, but I can get the report to work and filter via SendObject.
That produces a standard email. What I want to do is generate a Task Request
and assign it to a person. The report will be an attachment to the Task
Request. How do I pass the filtered Access Report to Outlook as an attachment
with out having to manually do it?
 
Not sure I have done it the way you are, but if you use the Open event of
the report to apply the filter, then it will be a filtered report that
opens. Can you do that?
 
Yes, I can filter it on Open. How do I use it as an attachment to the task
without having to save it somewhere first?

I am doing this all through automation. I can create the Task and assign it
but I can not attach an Access.report to a task as an Outlook.Attachment. Or
should I say I do not know how.
Thanks
 
I have not done it that way, so can't help further.

Perhaps someone else has used the approach you are taking, and can
contribute.
 
Back
Top