Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Fax Access Report From Access

Status
Not open for further replies.

mrsbean

Technical User
Jul 14, 2004
203
US
I have done some tinkering and lots of reading tonight, and I have come up with a method (that works - hurray!) for sending a fax directly from Access using Microsoft Fax and Outlook.

The first page of the fax shows only


Subject: Fax Report
Hi, this is a fax

This is a very plain coversheet, and I would like to expand on the idea.

How did I manage to fax from Access? I got the gist of the idea from:


"James" has a post at the bottom of the page where he explains that you can do the fax thing by exporting the report to an RTF format document first. I got the idea to use a Snapshot format document and came up with the following:

First, went into Control Panel, Mail and Email Accounts, View or Change Existing Email Accounts, Additional Server Types, selected Fax Mail Transport. I finished up this process and exited the mail setup. I went to Microsoft.com and downloaded the stand-alone Snapshot Viewer, installed it. I didn't need the snapshot viewer before because I do have it available within Access, but installing it in addition to access allows windows to recognize the *.snp as a snapshot viewer document.

I set up a form which contains my customer information including a fax number in a text box. I set up a button on the form and added the following code (include a reference in the VBA references for Microsoft Outlook):

Code:
Dim MyReportName as String
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem

MyReportName = "some report you want to fax"

'make sure that c:\TEMP directory exists or use some other directory

DoCmd.OutputTo acOutputReport, MyReportName, "Snapshot Format", "C:\TEMP\MyReport.snp", False

Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
' do stuff with MyMail, e.g.
MyMail.To = "[Fax: " & Me!AFaxNumber & "]"
MsgBox MyMail.To

MyMail.Subject = "Fax Report"
MyMail.Attachments.Add "C:\MyReport.snp", olByValue, 1, "Fax Report"
MyMail.Body = "Hi, this is a fax" & vbNewLine
MyMail.Display

Set MyMail = Nothing
Set MyOutlook = Nothing


Can anybody tell me how to dress up the fax cover sheet?

MrsBean
 
I answered my own question, and since I searched high and low for an answer before finding one (trial and error), here is the code I came up with to send a fax with a customized coversheet direclty from Microsoft Access:

Code:
DoCmd.OutputTo acOutputReport, "Auburn library", "Snapshot Format", "C:\MyReport.snp", False
DoCmd.OutputTo acOutputReport, "rptCoverSheet", "Snapshot Format", "C:\SomeCoverSheet.snp", False

Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem


Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
' do stuff with MyMail, e.g.
MyMail.To = "[Fax: " & Me!AFaxNumber & "]"


MyMail.Attachments.Add "C:\SomeCoverSheet.snp", olByValue, 1, "Cover Page"
MyMail.Attachments.Add "C:\MyReport.snp", olByValue, 2, "Fax Report"
MyMail.Send

Set MyMail = Nothing
Set MyOutlook = Nothing

MrsBean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top