Re: Email single record on a report
- From: "weircolin@xxxxxxxxxxxxxx" <weircolin@xxxxxxxxxxxxxx>
- Date: 4 Sep 2006 06:56:47 -0700
Hi
Thanks, working great now! Really appreciate it!
Take care
Colin
Rick Brandt wrote:
<weircolin@xxxxxxxxxxxxxx> wrote in message
news:1157376739.092389.206520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi
I have a form and I am wanting to be able to email the current record
that is showing, but it's not wanting to play. This is the code I am
using.
Dim stDocName As String
stDocName = "rptnewsletterdatabase"
strWhere = "[Reference Number] = " & Me.[Reference Number]
DoCmd.SendObject acReport, stDocName, , strWhere
SendObject doesn't have a WHERE argument like OpenReport does. You have a few
alternatives.
You can exploit a behavior in Access wherein executing a report that is already
opened in preview mode will always produce the same filtering as the one being
previewed. So if you use OpenReport to preview the report with your WHERE
clause and then immediately follow that line of code with your SendObject line
then the report in your Email will be filtered identically.
You can put your WHERE clause in a variable or form control and then have the
Open event of the report run code that evaluates it and applies that same filter
to itself.
You can modify the SQL of the Report's RecordSource query on-the-fly with your
code and then use SendObject.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
.
- References:
- Email single record on a report
- From: weircolin@xxxxxxxxxxxxxx
- Re: Email single record on a report
- From: Rick Brandt
- Email single record on a report
- Prev by Date: Re: Degree Symbol
- Next by Date: Automatic Select of Format for Email report
- Previous by thread: Re: Email single record on a report
- Next by thread: Automatic Select of Format for Email report
- Index(es):
Relevant Pages
|