LincolnMarkV
Programmer
Hello all,
I am trying to setup a fax function that is run from a command button on a form. The reports gather info from the form and the report is saved to the C drive. This works fine for Snapshot (.snp) files, but is giving me problems when trying to attach a (.jpg) or a (.txt) file. Below is the code used in my command button.
------------------------------------------------------------
Private Sub cmdFax_Click()
DoCmd.OutputTo acOutputReport, "rptStaffInformation", "Snapshot Format", "C:\StaffInformation.snp", False
Dim MyOutlook As Outlook.application
Dim MyMail As Outlook.MailItem
Dim FaxNumber As String
FaxNumber = Me.txtPhoneNumber
Set MyOutlook = New Outlook.application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "[Fax: " & FaxNumber & "]"
MyMail.Attachments.Add "C:\StaffInformation.snp", olByValue, 1, "Cover Page"
MyMail.Attachments.Add "C:\Test.jpg", olByValue, 2, "Fax Report"
MyMail.Send
Set MyMail = Nothing
Set MyOutlook = Nothing
End Sub
------------------------------------------------------------
Any advise would be appreciated.
-Dave
I am trying to setup a fax function that is run from a command button on a form. The reports gather info from the form and the report is saved to the C drive. This works fine for Snapshot (.snp) files, but is giving me problems when trying to attach a (.jpg) or a (.txt) file. Below is the code used in my command button.
------------------------------------------------------------
Private Sub cmdFax_Click()
DoCmd.OutputTo acOutputReport, "rptStaffInformation", "Snapshot Format", "C:\StaffInformation.snp", False
Dim MyOutlook As Outlook.application
Dim MyMail As Outlook.MailItem
Dim FaxNumber As String
FaxNumber = Me.txtPhoneNumber
Set MyOutlook = New Outlook.application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "[Fax: " & FaxNumber & "]"
MyMail.Attachments.Add "C:\StaffInformation.snp", olByValue, 1, "Cover Page"
MyMail.Attachments.Add "C:\Test.jpg", olByValue, 2, "Fax Report"
MyMail.Send
Set MyMail = Nothing
Set MyOutlook = Nothing
End Sub
------------------------------------------------------------
Any advise would be appreciated.
-Dave