473,466 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Snapshot Report From Access To Outlook

I was wondering if it would be possible to snapshot an access report
to Outlook, and have fields come in the To: and Cc: fields, and also
the subject field of the email as well. Right now, I am able to click
on a button on an access form, and have it snapshot the report to an
email. Here is the code:

************************************************** **************
Sub cmdSaveRecord_Click()

Dim stDocName As String
Dim stCriteria As String

On Error GoTo Err_cmdSaveRecord_Click

' save the inputed values
Me![txtIdentNumber] = Me![txtIdentNumberIn]
Me![txtPacketSequenceNo] = Me![txtPacketSequenceNoIn]
Me![txtDueDate] = Me![txtDueDateIn]
Me![txtDateRecd] = Me![txtDateRecdIn]
Me![txtDescription] = Me![txtDescriptionIn]

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70

Me![cmdAddNewRecord].Enabled = True
Me![cmdExit].SetFocus
Me![cmdSaveRecord].Enabled = False

stDocName = "Shop Drawing Routing - Rev"
stCriteria = "([SD_TRACKING_TABLE]![IdentNumber]= " & """" &
SDIdentificationNumber & """)" & " AND
([SD_TRACKING_TABLE]![PacketSequenceNo]= " &
LTrim(Str(SDSequenceNumber)) & ")"

DoCmd.OpenReport stDocName, acPreview, , stCriteria
DoCmd.Maximize

**The following line of code actually takes a snapshot of the **report
and sends it out to Outlook, as an attachment.

DoCmd.SendObject acSendReport, , acFormatSNP, , , , _
"Shop Drawing Transmittal"

Exit_cmdSaveRecord_Click:
Exit Sub

Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click

End Sub
************************************************** ***************

In the actual report, there are two fields, one with the Team
Manager's name, represented by the field TeamMgr, and the other for
the Designer, represented by the field Dsgnr. I was wondering if it
would be possibly, while sending out the report to Outlook, to
automatically have those fields, be associated with names in our
Outlook Address list, and have it so the TeamMgr field goes in the To:
field, and the Dsgnr field goes to the Cc: field. There is also a
project number, represented by the field ProjNum, that I would like to
have put in the subject line of the message as well. Any help on this
would be greatly appreciated! Thanks in advance,

Jonathan
Nov 13 '05 #1
1 2064
The following code will create a blank email, using the variables
TeamMgr, Dsgnr and ProjNum to set properties of the email (you will
need to Add the Microsoft Outlook 9 Object Library reference to your
database. When viewing your code select Tools - References from the
menu to do this):

Dim objFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem
Dim ol As Object
Dim olns As Object

' set up the Outlook objects
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set objFolder = olns.GetDefaultFolder(olFolderOutbox)
Set objItem = objFolder.Items.Add(olMailItem)

' create the mail
objItem.Recipients.Add(TeamMgr).Resolve
objItem.CC.Add(Dsgnr)
objItem.Subject = "Project: " & ProjNum
objItem.Body = "whatever you want as the body of the email" &
Chr(13) & _
"on however many lines you want"
objItem.Display ' OR objItem.Send

Set objItem = Nothing
Set objFolder = Nothing

You may have to use the objitem.Attachments.Add() method to attach
your files

Hope this helps

Chris
Nov 13 '05 #2

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

Similar topics

7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
5
by: tom | last post by:
Hey All- I've exported a report to Access's "snapshot" format and want to put it on a website for users to view. However, when I click on the link to the snapshot file, I notice that my browser...
0
by: Filips Benoit | last post by:
Dear All, Email a report as snapshot doesn't work in access 2K but it works fine in access 2002 ? It seems to start outlook-express but nothing happens and no error is returned ? ...
9
by: bluedolphin | last post by:
Hello All: I have been brought onboard to help on a project that had some performance problems last year. I have taken some steps to address the issues in question, but a huge question mark...
3
by: Prakash Wadhwani | last post by:
Hi !! I have been browsing around but have not been able to find a simple, lucid solution ... or maybe I'm just too confused. I know this has been asked before by many ... but pls bear with me. ...
2
by: @ndy | last post by:
When i save my rapport as a snapshot it only saves the helft of the page. I have no idee why this happens. Have somebody allreadt has this problem.
4
by: Salad | last post by:
Hi: I have the following line: DoCmd.SendObject acSendReport, "TestReport", _ "SnapshotFormat (*.snp)", _ "joeblow@nowhere.com", , , "Report Test", _ "Does it open correctly?", True I have...
1
by: Vincel2k2 | last post by:
Hi, I need to provide Access reports from our web site. When the app gets to the output command I get this error I get this error: The formats that enable you to output data as a Microsoft Excel,...
8
by: grant | last post by:
Hi I've copied Stephens code into my db, and can get it to work, but only on "plain Jane" reports with no images. Most of my reports has an unbound image obluect in them that I set to an...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.