(Msg. 1) Posted: Wed Sep 03, 2008 8:52 am
Post subject: SendObject report with a filter Archived from groups: microsoft>public>access>reports (more info?)
I have a report that I can open using DoCmd.OpenReport and pass it filter
criteria in the WHERE clause. Now I need to send that same report as an RTF
in an email, but I’m not sure how I can get the filter to work. I was
applying the filter in code because it can change based on what is selected
in the form. I thought of putting each filter in a separate report, but I
would prefer to avoid that since it would end up adding multiple reports to
my database that all do the same thing.
(Msg. 2) Posted: Thu Sep 04, 2008 7:01 am
Post subject: RE: SendObject report with a filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I have a report that I only want a specific record emailed in HTML format.
The code I used to do this is as follows:
> I have a report that I can open using DoCmd.OpenReport and pass it filter
> criteria in the WHERE clause. Now I need to send that same report as an RTF
> in an email, but I’m not sure how I can get the filter to work. I was
> applying the filter in code because it can change based on what is selected
> in the form. I thought of putting each filter in a separate report, but I
> would prefer to avoid that since it would end up adding multiple reports to
> my database that all do the same thing.
(Msg. 3) Posted: Fri Sep 05, 2008 3:13 pm
Post subject: RE: SendObject report with a filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks, that works really well. I added acHidden to the open report so the
users don't see the report before it goes right into an email. One thing I'm
finding is that my filter only seems to apply every other time I press the
button. The other times it opens with the same filter setting as the last
button press. When the filter fails, it also does not open in Hidden mode.
Have you ever experienced this and/or know a way to keep it from happening?
"Maverick" wrote:
> I have a report that I only want a specific record emailed in HTML format.
> The code I used to do this is as follows:
>
> ------------------------------------------------------------------------------------------------
>
> Dim stDocName As String
>
> stDocName = "rptCaseDetails"
>
> DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & [ID]
>
> DoCmd.SendObject acReport, stDocName, acFormatHTML,
> DLookup("[EmailAddress]", "tblEmployees", "[ID]=" & Nz([AssignedTo], 0)), , ,
> Replace(Replace("Request |1: |2", "|1", Nz([ID], "")), "|2", Nz([Title], ""))
>
> DoCmd.Close acReport, stDocName
>
> ------------------------------------------------------------------------------------------------
> "Jeff Hunt" wrote:
>
> > I have a report that I can open using DoCmd.OpenReport and pass it filter
> > criteria in the WHERE clause. Now I need to send that same report as an RTF
> > in an email, but I’m not sure how I can get the filter to work. I was
> > applying the filter in code because it can change based on what is selected
> > in the form. I thought of putting each filter in a separate report, but I
> > would prefer to avoid that since it would end up adding multiple reports to
> > my database that all do the same thing.
(Msg. 4) Posted: Fri Sep 05, 2008 3:29 pm
Post subject: RE: SendObject report with a filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Nevermind, figured out the every other time thing. It only did it when I
canceled the email, so I just added the docmd.close acreport to my error
handler as well. Thanks again for the tip!
"Jeff Hunt" wrote:
> Thanks, that works really well. I added acHidden to the open report so the
> users don't see the report before it goes right into an email. One thing I'm
> finding is that my filter only seems to apply every other time I press the
> button. The other times it opens with the same filter setting as the last
> button press. When the filter fails, it also does not open in Hidden mode.
> Have you ever experienced this and/or know a way to keep it from happening?
>
> "Maverick" wrote:
>
> > I have a report that I only want a specific record emailed in HTML format.
> > The code I used to do this is as follows:
> >
> > ------------------------------------------------------------------------------------------------
> >
> > Dim stDocName As String
> >
> > stDocName = "rptCaseDetails"
> >
> > DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & [ID]
> >
> > DoCmd.SendObject acReport, stDocName, acFormatHTML,
> > DLookup("[EmailAddress]", "tblEmployees", "[ID]=" & Nz([AssignedTo], 0)), , ,
> > Replace(Replace("Request |1: |2", "|1", Nz([ID], "")), "|2", Nz([Title], ""))
> >
> > DoCmd.Close acReport, stDocName
> >
> > ------------------------------------------------------------------------------------------------
> > "Jeff Hunt" wrote:
> >
> > > I have a report that I can open using DoCmd.OpenReport and pass it filter
> > > criteria in the WHERE clause. Now I need to send that same report as an RTF
> > > in an email, but I’m not sure how I can get the filter to work. I was
> > > applying the filter in code because it can change based on what is selected
> > > in the form. I thought of putting each filter in a separate report, but I
> > > would prefer to avoid that since it would end up adding multiple reports to
> > > my database that all do the same thing.
(Msg. 5) Posted: Mon Sep 08, 2008 9:49 am
Post subject: RE: SendObject report with a filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Happy to help. Please mark this question as answered by clicking on yes next
to "Was this post helpful to you?" This helps others identify questions that
have solutions.
"Jeff Hunt" wrote:
> Nevermind, figured out the every other time thing. It only did it when I
> canceled the email, so I just added the docmd.close acreport to my error
> handler as well. Thanks again for the tip!
>
> "Jeff Hunt" wrote:
>
> > Thanks, that works really well. I added acHidden to the open report so the
> > users don't see the report before it goes right into an email. One thing I'm
> > finding is that my filter only seems to apply every other time I press the
> > button. The other times it opens with the same filter setting as the last
> > button press. When the filter fails, it also does not open in Hidden mode.
> > Have you ever experienced this and/or know a way to keep it from happening?
> >
> > "Maverick" wrote:
> >
> > > I have a report that I only want a specific record emailed in HTML format.
> > > The code I used to do this is as follows:
> > >
> > > ------------------------------------------------------------------------------------------------
> > >
> > > Dim stDocName As String
> > >
> > > stDocName = "rptCaseDetails"
> > >
> > > DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & [ID]
> > >
> > > DoCmd.SendObject acReport, stDocName, acFormatHTML,
> > > DLookup("[EmailAddress]", "tblEmployees", "[ID]=" & Nz([AssignedTo], 0)), , ,
> > > Replace(Replace("Request |1: |2", "|1", Nz([ID], "")), "|2", Nz([Title], ""))
> > >
> > > DoCmd.Close acReport, stDocName
> > >
> > > ------------------------------------------------------------------------------------------------
> > > "Jeff Hunt" wrote:
> > >
> > > > I have a report that I can open using DoCmd.OpenReport and pass it filter
> > > > criteria in the WHERE clause. Now I need to send that same report as an RTF
> > > > in an email, but I’m not sure how I can get the filter to work. I was
> > > > applying the filter in code because it can change based on what is selected
> > > > in the form. I thought of putting each filter in a separate report, but I
> > > > would prefer to avoid that since it would end up adding multiple reports to
> > > > my database that all do the same thing.
(Msg. 6) Posted: Sun Sep 14, 2008 6:10 pm
Post subject: Re: SendObject report with a filter [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Sep 3, 11:52 am, Jeff Hunt <JeffH... RemoveThis @discussions.microsoft.com>
wrote:
> I have a report that I can open using DoCmd.OpenReport and pass it filter
> criteria in the WHERE clause. Now I need to send that same report as an RTF
> in anemail, but I’m not sure how I can get the filter to work. I was
> applying the filter in code because it can change based on what is selected
> in the form. I thought of putting each filter in a separate report, but I
> would prefer to avoid that since it would end up adding multiple reports to
> my database that all do the same thing.
Hi Jeff,
Have you checked out our Total Access Emailer program? It'll take
care of this very easily for you. One of its features is the abilty
to filter Access reports for each recipient and include it in their
email as either the body of the HTML or text message, or an
attachment. In Access 2007, the report can be attached as a PDF file.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum