M
Mike
I've implemented the below code into an Access database
so that users can fax reports using our Shared Fax
Service. The code works perfectly and faxes are sent
successfully. But when the code is finished running
user's get the message:
Error Number: 0
What is causing this error to occur? Is this anything
serious? Thank you.
-------------------------------------------------------
Option Compare Database
Option Explicit
Function FaxReport()
Dim FaxDocumentObj As New FAXCOMEXLib.FaxDocument
Dim FaxServerObj As New FAXCOMEXLib.FaxServer
Dim JobIDObj As Variant
Dim CurrentReport As Report
'Error handling.
On Error GoTo Error_Handler
'Identify the active report.
Set CurrentReport = Screen.ActiveReport
'The report is first saved to file, THEN the FILE is sent
via fax
DoCmd.OutputTo acOutputReport, CurrentReport.Name, _
acFormatRTF, "Rpt.rtf", False
'Connect to the fax server.
FaxServerObj.Connect "faxservername"
'Set the fax body.
FaxDocumentObj.Body = "c:\1fax.txt"
'Name the document.
FaxDocumentObj.DocumentName = "Fax"
'Set the fax priority.
FaxDocumentObj.Priority = fptHIGH
'Add the recipient fax number.
FaxDocumentObj.Recipients.Add "8888888888", "Mike"
'Choose to attach the fax to the fax receipt.
FaxDocumentObj.AttachFaxToReceipt = True
'Set the cover page type and the path of the cover page.
FaxDocumentObj.CoverPageType = fcptSERVER
FaxDocumentObj.CoverPage = "StandardCP"
'Provide the cover page note.
FaxDocumentObj.note = "Attached you will find your quote
(s). Thank you for your business."
'Provide the address for the fax receipt.
FaxDocumentObj.ReceiptAddress = "(e-mail address removed)"
'Set the receipt type to e-mail.
FaxDocumentObj.ReceiptType = frtMAIL
FaxDocumentObj.Subject = "Quote"
'Set the sender properties.
FaxDocumentObj.Sender.Name = "SenderName"
FaxDocumentObj.Sender.Company = "CompanyName"
'Save sender information as default.
FaxDocumentObj.Sender.SaveDefaultSender
'Submit the document to the connected fax server, and
retrieve the job ID.
JobIDObj = FaxDocumentObj.ConnectedSubmit(FaxServerObj)
MsgBox "The fax is being sent." & vbCrLf & "You will
receive a transmission status via e-mail in 3-5 minutes."
Error_Handler:
'Implement error handling at the end of your
subroutine. This implementation is for demonstration
purposes
MsgBox "Error number: " & Hex(Err.Number)
End Function
-------------------------------------------------------
so that users can fax reports using our Shared Fax
Service. The code works perfectly and faxes are sent
successfully. But when the code is finished running
user's get the message:
Error Number: 0
What is causing this error to occur? Is this anything
serious? Thank you.
-------------------------------------------------------
Option Compare Database
Option Explicit
Function FaxReport()
Dim FaxDocumentObj As New FAXCOMEXLib.FaxDocument
Dim FaxServerObj As New FAXCOMEXLib.FaxServer
Dim JobIDObj As Variant
Dim CurrentReport As Report
'Error handling.
On Error GoTo Error_Handler
'Identify the active report.
Set CurrentReport = Screen.ActiveReport
'The report is first saved to file, THEN the FILE is sent
via fax
DoCmd.OutputTo acOutputReport, CurrentReport.Name, _
acFormatRTF, "Rpt.rtf", False
'Connect to the fax server.
FaxServerObj.Connect "faxservername"
'Set the fax body.
FaxDocumentObj.Body = "c:\1fax.txt"
'Name the document.
FaxDocumentObj.DocumentName = "Fax"
'Set the fax priority.
FaxDocumentObj.Priority = fptHIGH
'Add the recipient fax number.
FaxDocumentObj.Recipients.Add "8888888888", "Mike"
'Choose to attach the fax to the fax receipt.
FaxDocumentObj.AttachFaxToReceipt = True
'Set the cover page type and the path of the cover page.
FaxDocumentObj.CoverPageType = fcptSERVER
FaxDocumentObj.CoverPage = "StandardCP"
'Provide the cover page note.
FaxDocumentObj.note = "Attached you will find your quote
(s). Thank you for your business."
'Provide the address for the fax receipt.
FaxDocumentObj.ReceiptAddress = "(e-mail address removed)"
'Set the receipt type to e-mail.
FaxDocumentObj.ReceiptType = frtMAIL
FaxDocumentObj.Subject = "Quote"
'Set the sender properties.
FaxDocumentObj.Sender.Name = "SenderName"
FaxDocumentObj.Sender.Company = "CompanyName"
'Save sender information as default.
FaxDocumentObj.Sender.SaveDefaultSender
'Submit the document to the connected fax server, and
retrieve the job ID.
JobIDObj = FaxDocumentObj.ConnectedSubmit(FaxServerObj)
MsgBox "The fax is being sent." & vbCrLf & "You will
receive a transmission status via e-mail in 3-5 minutes."
Error_Handler:
'Implement error handling at the end of your
subroutine. This implementation is for demonstration
purposes
MsgBox "Error number: " & Hex(Err.Number)
End Function
-------------------------------------------------------