faxing report Access 2007



Want to automate faxing of multiple reports from Access (&Runtime) running on
XPSP2 machines with a shared fax printer on 2003 Enterprise Server (not

Have following code mostly from MSDN Windows, Networking, Communications

It will connect and return values from either a local or network fax
printer, and both fax printers work fine with the faxcomex.dll wizzard.

However, the "ConnectedSubmit" statement returns "Operation Failed."

I'm guessing I've missed a reference or setting, but can't figure out which?
Oops showed e-mail code too, that does work too.

DoCmd.OpenReport "StatementsNOCME", acViewPreview
Set rptStatements = Reports("StatementsNOCME")
rptStatements.Printer = Application.Printers!Office
rptStatements.Printer.PaperSize = acPRPSLetter
rptStatements.Printer.LeftMargin = 0.5
rptStatements.Printer.RightMargin = 0.5
rptStatements.Printer.TopMargin = 0.5
rptStatements.Printer.BottomMargin = 0.5
SendR = MsgBox("Do you wish to send this e-mail to the address in the
Customer's file?", vbYesNo)
If SendR = 6 Then

DoCmd.SendObject acSendReport, "StatementsNOCME", acFormatPDF,
Me.[E-Mail], , , MsgSubject, MsgBody, 0

End If
End If

'preview Faxed Statement
If Me.FaxYN = True Then
DoCmd.OpenReport "StatementsNOCMF", acViewPreview
Set rptStatements = Reports("StatementsNOCMF")
rptStatements.Printer = Application.Printers!Office
SendR = MsgBox("Do you wish to send this fax to the number in the Customer's
file?", vbYesNo)
If SendR = 6 Then

Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objFaxDoc As New FAXCOMEXLib.FaxDocument
'Dim objSender As FaxSender
Dim JobID As Variant
'DoCmd.SendObject acSendReport, "StatementsNOCMF", acFormatRTF, "[fax: "
& Me.APFaxPhone & "]", , , , , 0
DoCmd.OutputTo acSendReport, "StatementsNOCMF", acFormatRTF,

objFaxServer.Connect ""
'Display server properties
'objFaxDoc.Recipients.Add CStr(Me.APFaxPhone)
objFaxDoc.Recipients.Add "15203840426"
SendR = MsgBox(objFaxServer.APIVersion, , "APIVersion")
SendR = MsgBox(objFaxServer.Debug, , "Debug")
SendR = MsgBox(objFaxServer.MajorBuild, , "MajorBuild")
SendR = MsgBox(objFaxServer.ServerName, , "ServerName")
objFaxDoc.Body = "c:\TempFaxFile"
objFaxDoc.DocumentName = "ARFax"
objFaxDoc.Priority = fptNORMAL

'objFaxDoc.ScheduleType = fstSPECIFIC_TIME
'objFaxDoc.ScheduleTime = Now() + 0.4

objFaxDoc.Subject = "Statement"
objFaxDoc.Sender.City = "Tucson"
objFaxDoc.Sender.Company = "Southwest Glassware"
objFaxDoc.Sender.Email = "(e-mail address removed)"
objFaxDoc.Sender.faxnumber = "5202929826"
objFaxDoc.Sender.OfficePhone = "5202920556"
objFaxDoc.Sender.Department = "Accounts Rec."

'JobID = objFaxDoc.Submit("")
JobID = objFaxDoc.ConnectedSubmit(objFaxServer) 'original MS code
'SendR = MsgBox(JobID, , "JobID")

objFaxServer = Nothing
objFaxDoc = Nothing

End If
End If


In case this helps others: The SDK disk arrived, lots of good examples
there. Above code works if "Call" method substituted and "=nothing" code

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question