Use SendObject to send many reports to many different email addres

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

Guest

Hi guys, I have a report that is a quotation follow report - it shows all
quotes in the last two months against which an order is yet to be placed.

The report is basically a letter reminding the customer of what the
quotation was for and a short paragraph asking them if they would like to
place an order. The idea is that the report gets printed out and each letter
put in an envelope and sent.

Now in order to save money my boss has asked if these reports can be
automatically emailed to our customers. I have each customer's email address
saved in the database. Is it possible to have each page/pages of the report
emailed to each specific customer?

The research I have done tells me that the SendObject command needs to be
used, but the examples I have seen so far only email the whole report to each
address.
 
Hi Richard,

you can save the appropriate report filter before each
SendObject

Sub SetReportFilter( _
ByVal pReportName As String, _
ByVal pFilter As String)

' written by Crystal
' Strive4peace2007 at yahoo dot com

' PARAMETERS:
' pReportName is the name of your report
' pFilter is a valid filter string

' USEAGE:
' SetReportFilter "MyReportname","someID=1000"
' SetReportFilter "MyAppointments", _
"City='Denver' AND dt_appt=#9/18/05#"

On Error Goto Proc_Err

'---------- declare variables
Dim rpt As Report

'---------- open design view of report
' --- and set the report object variable

DoCmd.OpenReport pReportName, acViewDesign
Set rpt = Reports(pReportName)

'---------- set report filter and turn it on
rpt.Filter = pFilter
rpt.FilterOn = IIf(Len(pFilter) > 0, True, False)

'---------- save and close the changed report
DoCmd.Save acReport, pReportName
DoCmd.Close acReport, pReportName

'---------- Release object variable
Set rpt = Nothing

Proc_Exit:
Exit Sub

Proc_Err:
msgbox err.description,, _
"ERROR " & err.number & " SetReportFilter"

'press F8 to step thru code and fix problem
'comment next line after debugged
Stop: Resume
'next line will be the one with the error

resume Proc_Exit:

End Sub
Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
Back
Top