473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Email Access Report as "Body"

365 Contributor
Hello to all,

i have a new interesting problem to solve....
i have a report that i would like to email to a list of users,
the report is a full page document and is personalised to each user (basically) more than one user can have the same email address so i will create a recordset to list all of the users (who need the email) and loop through the users and send to the associated email address, i have a few problems

1)currently the report is set up to list all the reports in the same report.... make sense? so i would need to send only the correct page... is that possible? if not then i will have to alter the reprt to build using the info from my aforementioned loop.

2)the biggest obsticle is that i want the report (sent as html) to be the body of the email, i have tried this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject acSendReport, "report1", acFormatHTML, EmailAddress, , , "Subject:____", "report1"
  2.  
this opens the email to be edited (which i dont want to do) but the report does send as the body this way

so i tried this (to NOT edit)

Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject acSendReport, "report1", acFormatHTML, EmailAddress, , , "Subject:____", "report1", false
  2.  
which does send the email straight away... but sends the report as an attachment... any ideas?

thanks for ya help guys

Dan Out
Feb 20 '08 #1
10 9932
Dan2kx
365 Contributor
Any ideas anyone?
Cheers
Feb 21 '08 #2
maxvernon
12 New Member
good luck getting the result you want natively from Access. I send data from Access via email all the time for various purposes but have never been able to do it "the way I want" using Access by itself. More recently I have been building an HTML version of the report in code, then sending that as the body of an email using either the Redemption Outlook DLL or a DLL I wrote in VB.NET.

If you like I will put together some sample VB.NET source code for you...
Feb 21 '08 #3
Dan2kx
365 Contributor
That would be useful if you could, but it would need some explaining as to how i would implement it (and alter it) and i have no experience with VB.net

if you could help then that is great, if not then can i assume that i will just have to accept the report being sent as an attachment?
Feb 21 '08 #4
maxvernon
12 New Member
Sending it the way you mention in your first post is the easiest by far. If you have no experience with .Net you are going to be in for more than you expected...

That would be useful if you could, but it would need some explaining as to how i would implement it (and alter it) and i have no experience with VB.net

if you could help then that is great, if not then can i assume that i will just have to accept the report being sent as an attachment?
Feb 22 '08 #5
maxvernon
12 New Member
I will work on some sample code for you and get back to you
Feb 22 '08 #6
maxvernon
12 New Member
I have just created a page detailing how to create an SMTP DLL which allows you to specify the entire body of the email as SMTP. In order to fully implement your report as the body you will need to do further research into compiling your data into an HTML page.

The SMTP DLL code is at ** Edit - Removed link to external code **

I hope this helps you out to some small degree...
Feb 22 '08 #7
NeoPa
32,556 Recognized Expert Moderator MVP
Max,

You are welcome to include your code in a post, but linking offsite to code is not allowed.

Admin.
Mar 3 '08 #8
Denburt
1,356 Recognized Expert Top Contributor
I almost always use CDO for sending email as you stated I like to send my reports via the email body verses an attachment. Using CDO you may find you have to mess around with the configuration a bit to get it to work but it works and quite nicely I might add. Here is a link to a post with some sample code that may help.

http://forums.microsoft.com/MSDN/Sho...23601&SiteID=1

To use this you will need to add a reference (in the VBA window under tools/references)

I generally export to HTML like so then read the info and into the email it goes.

Expand|Select|Wrap|Line Numbers
  1. strPath = Application.CurrentProject.Path
  2. DoCmd.OutputTo acOutputReport, "Rate Division", acFormatHTML, strPath & "\RD.HTML", False
  3.  Set fso = CreateObject("Scripting.FileSystemObject")
  4.  Set ts = fso.OpenTextFile(Application.CurrentProject.Path & "\RD.HTML", ForReading, False) '.CreateTextFile(vFile)
  5. 'Exit Function
  6.  tsR = ts.ReadAll
  7.   ts.Close
  8.  Set ts = Nothing
  9.  
  10.  
  11. .HTMLBody = tsR 
  12.  

Sometimes exporting a report to HTML can be quite nasty so in those circumstances I XML with an XSL style sheet to produce my desired results then transfer that into the email (again opening it as text then .readall etc.).

Good luck any questions feel free to ask.
Mar 3 '08 #9
Denburt
1,356 Recognized Expert Top Contributor
I posted then I saw your post Neo. I know Microsoft informational pages are O.K. but what about the Microsoft forum? The topic is inline and I thought the thread was informative as well. Please edit my post as you see fit. Thanks
Mar 3 '08 #10
NeoPa
32,556 Recognized Expert Moderator MVP
Denburt,

This is not the same thing at all. Microsoft links are fine. They are not there to advertise their site. They are, after all, the vendor of the software that we're all working in.

What was removed was a link to the poster's own web site where they'd posted the code that should have been posted in here.

I'm glad you asked though as it illustrates the situation more clearly.
In short, no edit required :)
Mar 4 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Shiperton Henethe | last post by:
Hi Anyone know how to do a MAILTO: such that the "BODY=" parameter contains carriage returns ? e.g. <A HREF="mailto:brochure@webwindows.co.uk?subject=Brochure Request&amp;body=Line1 blah blah...
3
by: John Dalberg | last post by:
Hi I have a form that opens a new window for the results. Because the results might take a few seconds due to server processing, I would like to display a message "please wait" in the new...
4
by: Viken Karaguesian | last post by:
Hello all, I have a question. I trying to run two Javascripts on my webpage, both of which need a <body onload> command. They are as follows: <body onload="runMe()"> <body...
2
by: chuckdfoster | last post by:
I am getting a "Could Not Access CDO.Message Object" Error when I try to use the following code to send an email via ASP.NET. When I run this on one machine it works, on another one it doesn't. ...
1
by: Chad Dittmer | last post by:
I'd appreciate anyone's help with this. I'm trying to open an email window and have it auto fill from vb.net. It works, except I can't get line breaks in the body. I've tried: vbLf vbCrLf...
3
by: John Draper | last post by:
In "smtplib" module, the "sendmail" method of function is to be passed a host, but it is the Domain name for the SMTP Server as gotten from the "dig" command? IE: dig -tMX would give me the...
1
by: abilashnn | last post by:
'm attempting to send a mailto: and include a link in the body. Has anyone done this? I have one problem with this. One appln have a link to send an email using “mailto:”. Previosly this...
8
by: Mark | last post by:
Using VB.net 2005, I am trying to send an email with attachments in Outlook. I have tried using this article from Microsoft, (http://support.microsoft.com/?kbid=313803), but I can't even get the...
2
by: GArlington | last post by:
"G. Morgan" <no_em@il.invalidwrote in message news:8787770faf30b1bd48f393baa1a89fdbnp@mypost.invalid... <snap> <snap> Did you try <cr><lf combination? ** Posted from http://www.teranews.com...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.