E-mailing a report

K

Kate Cz

Hello, I've seen several postings, but am a beginner and don't understand
quite yet:

How can I e-mail a report from a form of only the current record? When I try
to e-mail it now, the report contains all of my records. If anyone can help
the more direction the better ie if this requires code, where, what, how, etc.
If I can do it in a macro, that would be preferable as I do understand those.


Thank you,
 
D

David Lloyd

Kate:

In the Click event of a form button, you might want to try code similar to
the following:

DoCmd.OpenReport "MyReport", acViewPreview, , "ID=" &
CInt(txtIDField), acHidden
DoCmd.SendObject acSendReport, "", acFormatSNP, "(e-mail address removed)",
, , "Email Subject", "Email Message", False
DoCmd.Close acReport, "MyReport", acSaveNo

The idea here is to use the Where parameter of the OpenReport method ("ID="
& CInt(txtIDField) ) to limit the report to a single record. This example
assumes you have an ID field on your form in a textbox called txtIDField.
You will have to adjust this to use a field on your form that distinguishes
each record. Once we have opened the filtered report, we can call the
SendObject method to email the open report to the recipient. Finally, the
open report is closed.

I have used the acFormatSNP constant to email a snapshot in this example.
You can choose another format to suit your needs.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hello, I've seen several postings, but am a beginner and don't understand
quite yet:

How can I e-mail a report from a form of only the current record? When I try
to e-mail it now, the report contains all of my records. If anyone can help
the more direction the better ie if this requires code, where, what, how,
etc.
If I can do it in a macro, that would be preferable as I do understand
those.


Thank you,
 
K

Kate Cz via AccessMonster.com

Much Appreciated David - This helped thank you.
David said:
Kate:

In the Click event of a form button, you might want to try code similar to
the following:

DoCmd.OpenReport "MyReport", acViewPreview, , "ID=" &
CInt(txtIDField), acHidden
DoCmd.SendObject acSendReport, "", acFormatSNP, "(e-mail address removed)",
, , "Email Subject", "Email Message", False
DoCmd.Close acReport, "MyReport", acSaveNo

The idea here is to use the Where parameter of the OpenReport method ("ID="
& CInt(txtIDField) ) to limit the report to a single record. This example
assumes you have an ID field on your form in a textbox called txtIDField.
You will have to adjust this to use a field on your form that distinguishes
each record. Once we have opened the filtered report, we can call the
SendObject method to email the open report to the recipient. Finally, the
open report is closed.

I have used the acFormatSNP constant to email a snapshot in this example.
You can choose another format to suit your needs.

Hello, I've seen several postings, but am a beginner and don't understand
quite yet:

How can I e-mail a report from a form of only the current record? When I try
to e-mail it now, the report contains all of my records. If anyone can help
the more direction the better ie if this requires code, where, what, how,
etc.
If I can do it in a macro, that would be preferable as I do understand
those.

Thank you,
 
G

Guest

Dear David:

Your method is quite helpful. But I have one more question, since my form
has another subform (ID, and e-mail address) to keep all e-mail addresses.

How can I mail the report to those who has the same ID??? Since the way you
provide is the dedicated e-mail address.

Thanks.

Vivi
 

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

E-Mailing a specific page of a report 1
E-mailing Report 2
E-mailing report 3
Send Report via e-mail group 1
E-Mailing report 2
E-Mailing a report 2
e-mailing sections of report 1
E-mail Merge 2

Top