Send a report by mail, to several addresses

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.
 
J

Jeff C

--
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
 

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

Top