Search code examples
windows-10windows-server-2003faxms-access-2016

Sending a fax in Access 2016 on Windows 10 (fax server uses Windows Server 2003)


I have a legacy Access 2003 application that we have been running in Wondows 7. I have decided to convert to Access 2016 so that it will continue to work in Windows 10 in case we ever need to replace one of our current Windows 7 machines and only Windows 10 is available. It pretty much converted perfectly except for one of its features, sending faxes.

Our fax server is a Windows Server 2003 machine, and like I said I am running my application in Access 2016 on a Windows 10 machine.

This is my fax code:

Public Sub SendFax(RptName, faxNumber, faxName)

Dim FS As New FAXCOMEXLib.FaxServer
Dim FD As New FAXCOMEXLib.FaxDocument
Dim strComputerName As String
Dim strFile As String

strComputerName = "server08"
strFile = "C:\Reports\test.snp"
DoCmd.OutputTo acOutputReport, RptName, acFormatSNP, strFile, False
DoCmd.Close acReport, RptName

FS.Connect (strComputerName)
FD.Body = strFile

FD.CoverPageType = fcptNONE

FD.DocumentName = "Test"
FD.priority = fptHIGH

'FD.Recipients.Add USCanonicalPhone(faxNumber), faxName
FD.Recipients.Add faxNumber, faxName

FD.Submit(strComputerName)

End Sub

I have also tried using:

FD.ConnectedSubmit(FS)

in place of FD.Submit but either way the code blows up on that line. I get the following error:

Run-time error '-2147023741 (80070483)': Operation failed.

I did happen to stumble upon this web page that is outdated and references Vista, but I wonder if it holds true for Windows 10 as well: Sending a Fax (Windows)

I also tried implementing that JobID variable shown on that page into my code, but it still results in the same error.

I do see that there is a workaround mentioned on the web page about write permissions, but I don't know how to do this, plus I don't have a C:\ProgramData directory on my computer.

I also wonder if I would be able to set up a Windows 7 machine as a fax server and if that would solve the problem. Of course our server is due for an upgrade given that its OS is 13 years old, would upgrading to Windows Server 2012 solve the problem? Or should I wait for Windows Server 2016 to be released?

Any help would be greatly appreciated. Thanks.


Solution

  • I figured this out. The issue is most definitely a file association issue. However it has nothing to do with Access 2016, or Windows Fax and Scan. It has to deal with how you view PDF's. (I assume the true would hold true for SNP files, but I only used SNP because Access 2003 didn't support export to PDF, no point in worrying about an outdated file format)

    The issue is that the default viewer for pdf on a new install of Windows 10 is Microsoft Edge, and Microsoft Edge does not support printing to Fax. To solve this problem you need to install Adobe Acrobat and set it as your default pdf viewer as it supports printing to faxes. Once you do this you will have no problem sending PDF files to your fax server using code or printing PDF files to your fax server that you have open in Acrobat.

    For those of you who are interested, here is my new code, not much has changed:

    Public Sub SendFax(RptName, faxNumber, faxName)
    
    Dim FS As New FAXCOMEXLib.FaxServer
    Dim FD As New FAXCOMEXLib.FaxDocument
    Dim strComputerName As String
    Dim strFile As String
    
    strComputerName = "server08"
    strFile = "C:\Reports\test.pdf"
    DoCmd.OutputTo acOutputReport, RptName, acFormatPDF, strFile, False
    DoCmd.Close acReport, RptName
    
    FS.Connect strComputerName
    FD.Body = strFile
    
    FD.CoverPageType = fcptNONE
    
    FD.DocumentName = "Test"
    FD.priority = fptHIGH
    
    FD.Recipients.Add faxNumber, faxName
    
    FD.Submit (strComputerName)
    
    
    End Sub
    

    Of course you will need to be using "Microsoft Fax Service Extended COM Type Library" in References.