Send a report by mail, to several addresses

  • Thread starter Thread starter Luis Marques
  • Start date Start date
L

Luis Marques

I have a report, subgrouped by client.

I need to send this report by mail, but each subgroup (client) must be
sended to a diferent address.

Can I do this with macros? I don’t have a lot of experience with VBA:

Thanks in advance.
 
--
Jeff C
Live Well .. Be Happy In All You Do


Luis Marques said:
I have a report, subgrouped by client.

I need to send this report by mail, but each subgroup (client) must be
sended to a diferent address.

Can I do this with macros? I don’t have a lot of experience with VBA:

Thanks in advance.

You need to build a query for your report that includes criteria to produce
the report for each individual group you want to email.

A simple form for the code below to reference.

Dim rstbl As ADODB.Recordset

Set rstbl = New ADODB.Recordset

rstbl.Open "table with email addresses", CurrentProject.Connection,
adOpenStatic

Do Until rstbl.EOF

[Forms]![yourform].[txtname].Value = rstbl![Name]
[Forms]![yourform].[txtEmail].Value = rstbl![E_Mail]

On Error Resume Next
DoCmd.SendObject acSendReport, "rpt_yourreport", acFormatSNP,
[Forms]![frm_EMail].[txtEmail], , , "subject", , True

On Error Resume Next
rstbl.MoveNext
Loop
 
Back
Top