473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Emailing 2 reports

dee
I need to send an email containing 2 reports.

I have tried sending a 2 page snapshot report, but while it prints
just fine before sending, email is only receiving 1 page.

Is there a way to do this in VB code?

Can I somehow program the 'Attach:' line in outlook express to include
'Report1' and 'Report2'?
If there is, I would very grateful for a few lines of code.

If this cannot be done, is there another way?
Oct 8 '08 #1
3 2199
ARC
Outlook express uses the MAPI method (simple docmd.sendjobject), which does
not support additional attachments other than the report you are sending.
For additional attachments, you'll need to use full outlook (not express or
windows mail), and the coding changes quite a bit. Look at the sample code
below, and you'll see where you can add additional attachments. Hope this
helps,

(There are a number of Me![FieldName] references below that refer to options
for importance, read receipt, etc. from the form the code is taken from).

Dim objOutlook As Object, sendaddr As String, MainLoopNum As Integer,
MainMail() As String, ExpFile As String, addlattach As String
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'
addr = Trim$(Me!txtEmail)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(addr)
objOutlookRecip.Type = olTo
End With
'
With objOutlookMsg
' Set the Subject, Body, and Importance of the message.
.Subject = Me!txtSubject
'If Me!chkEnableRich = -1 Then
' .HTMLBody = Me!txtBody
'Else
.Body = Me!txtBody
'End If
If Me!cboPriority = 2 Then
.Importance = olImportanceHigh 'High importance
End If
'
'Check for read receipt
If Me!ChkReceipt = -1 Then
.ReadReceiptRequested = True
End If
'ReadReceiptRequested

Set objOutlookAttach = .Attachments.Add(ExpFile)
'additional attachments, repeat below
'Set objOutlookAttach = .Attachments.Add(ExpFile)

'
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
'If Not objOutlookRecip.Resolve Then
'objOutlookMsg.Display
'End If
Next
'objOutlook.visible = True
'.Send
.Display
End With
'Set objOutlookMsg = Nothing
Set objOutlook = Nothing
DoCmd.Hourglass 0
DoEvents

Oct 11 '08 #2
If you are considering "another way" of sending reports, consider a 'pdf'
file converter such as "nova PDF Pro" which installs itself on your machine
as one of your 'printers' on your "Printer List". When you bring up your
report and select File-->Print, and select 'novaPDF Pro as your 'printer',
it puts that report into a 'pdf' file to be 'saved' wherever you like and
then you can send it as an email attachment whenever. The advantage is that
as a 'pdf' file, your recipient does not have to have MS Access installed or
even MS Office as is the case with the 's.np' file format.

Earl
"dee" <pr******************@comcast.netwrote in message
news:e1**********************************@d10g2000 pra.googlegroups.com...
>I need to send an email containing 2 reports.

I have tried sending a 2 page snapshot report, but while it prints
just fine before sending, email is only receiving 1 page.

Is there a way to do this in VB code?

Can I somehow program the 'Attach:' line in outlook express to include
'Report1' and 'Report2'?
If there is, I would very grateful for a few lines of code.

If this cannot be done, is there another way?

Oct 11 '08 #3
Earl Anderson wrote:
If you are considering "another way" of sending reports, consider a 'pdf'
file converter such as "nova PDF Pro" which installs itself on your machine
as one of your 'printers' on your "Printer List". When you bring up your
report and select File-->Print, and select 'novaPDF Pro as your 'printer',
it puts that report into a 'pdf' file to be 'saved' wherever you like and
then you can send it as an email attachment whenever. The advantage is that
as a 'pdf' file, your recipient does not have to have MS Access installed or
even MS Office as is the case with the 's.np' file format.
I used NovaPDF for a while but due to some problems I had with it on
dualcore PCs I switched to Stephen Lebans snapshot to PDF converter and
it works like a champ. I liked NovaPDF because one could specifiy the
folder and filename to save it to.
Earl
"dee" <pr******************@comcast.netwrote in message
news:e1**********************************@d10g2000 pra.googlegroups.com...
>>I need to send an email containing 2 reports.

I have tried sending a 2 page snapshot report, but while it prints
just fine before sending, email is only receiving 1 page.

Is there a way to do this in VB code?

Can I somehow program the 'Attach:' line in outlook express to include
'Report1' and 'Report2'?
If there is, I would very grateful for a few lines of code.

If this cannot be done, is there another way?


Oct 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Hudson | last post by:
Ive developed a web based system where somebody can add a news record using ASP and MS Access database connectivity. The new record is inserted into the database and then a formatted email gets...
9
by: Brendan MAther | last post by:
I have a table called Contact_Info. I have a form that allows me to show all the contacts from a specified city and sector. Once these contacts appear on my new form I would like to be able to...
2
by: BerkshireGuy | last post by:
Is there a way to have reports sent to a pdf file and then emailed automatically using Lotus Notes 6? I have 3 reports and would like a button that the user clicks which then automatically makes...
2
by: Wayne | last post by:
I am experiencing an intermittent problem when emailing snapshot reports using Sendobject. Outlook opens with the snapshot of the report attached but when I click the "Send" button on the Outlook...
1
by: zEE | last post by:
Hi, I'm facing an issue when I use the MicrosoftMail option for emailing the crystal report. My code is as follows - ReportDocument ReportFile = new ReportDocument();...
1
by: crisostomofred | last post by:
I have a report with it's source from a query. The query calls data from 3 related tables. The report is a meeting agenda and I only want to attach a snapshot report to my email based on the...
1
by: Momo15 | last post by:
When I try exporting a report in Rich Text Format or Email it, some my data is altered. Additionally, when I try “emailing” the same thing happens. One of my reports with was landscape orientation...
2
by: Keriana30 | last post by:
I'm using the following code in an attempt to email reports from a database form in Access. With EMsg Set .Configuration = EConf .To = Recip (variable) .CC = "Susan.Miller@ocfl.net" .From =...
6
by: ladybug76 | last post by:
Hello. Okay, so I have an Option Group with 6 reports on the Right hand side of a form. On the left, I have 4 command buttons. 1) Preview 2) Print 3) Save off 4) Email. I want the user to be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.