Question:
Automated faxing from Access using Microsoft fax?
2007-04-11 06:34:13 UTC
After upgrading from XP to Vista, Winfax Pro no longer works (naturally), and to boot, Symantec has discontinued support for Winfax.

Has anyone found a way to programatically send faxes from Microsoft Access using Visual Basic?

I haven't had much luck talking to Microshaft.
Three answers:
logiegt5
2007-04-11 06:39:42 UTC
Have you tried this?



ACC: How to Fax from Microsoft Access Using SendObject Command



http://support.microsoft.com/kb/145787
Capt Crasher
2007-04-11 15:47:23 UTC
Access needs an auxilliary program to actually "send" items via fax or e-mail.

You'll have to work out the issues with WinFax or the latest/greatest version.



Alternatively, You could output to a the report to an .RTF or .SNP file , then drop a .bat file that initiates the mail/fax script for the reports new path. We do this using Perl's Mail-Attach program.
Sgt Pepper
2007-04-13 15:06:29 UTC
Consider using the following functions. They have not been tested under Vista, and of course I have no way of knowing what you've already tried. Your mileage may vary.



All code copyright © 1993-2007 Quick Software, Inc.

www.csvtools.com for more info and credentials



Function csvSendToWinFax(ByVal ReportName As String, ByVal PhoneNumber As String, ByVal Recipient As String, ByVal Company As String, ByVal Subject As String) As Boolean



' ----------------------------------------



' Purpose: Sends a specified report to the WinFax printer driver.



' Accepts: ReportName - name of the report to be sent



' PhoneNumber - phone number, including any external line access numbers, to be dialed



' Recipient - name of the recipient (upon success, appears in the WinFax log)



' Company - name of the recipient's company (upon success, appears in the WinFax log)



' Subject - subject of the fax (upon success, appears in the WinFax log)



' Returns: True - successful



' False - unsuccessful



' Uses : csvInfoMsg()



' csvOpenReport()



' Notes : This function was designed for WinFax Pro 8.0; WinFax must be running when you call this function.



' Related: csvSendEmail()



' ----------------------------------------



Dim Channel As Long



Dim Msg As String



Dim Okay As Boolean



Dim Temp As String



Dim X As Boolean



' ----------------------------------------



Const Q = """"



' ----------------------------------------



On Error Resume Next



Channel = DDEInitiate("FaxMng32", "control")



Okay = (Err = 0)



On Error GoTo 0



If Okay = True Then



DoEvents



Temp = Q & PhoneNumber & Q & ",,," & Q & Recipient & Q & "," & Q & Company & Q & "," & Q & Subject & Q



On Error Resume Next



DDEPoke Channel, "sendfax", "recipient(" & Temp & ")"



Okay = (Err = 0)



On Error GoTo 0



If Okay = True Then



Okay = csvOpenReport(ReportName, "print")



If Okay = True Then



DoEvents



Else



X = csvInfoMsg("Couldn't send fax to " & Q & Recipient & Q & ".", "Fax-R Error")



End If



Else



X = csvInfoMsg("Couldn't send fax to " & Q & Recipient & Q & ".", "Fax-P Error")



End If



DoEvents



On Error Resume Next



DDETerminate Channel



On Error GoTo 0



DoEvents



Else



Msg = "Couldn't initiate connection with WinFax, probably because WinFax is not already running."



X = csvInfoMsg(Msg, "Fax-I Error")



End If



' ----------------------------------------



csvSendToWinFax = Okay



End Function



Function csvInfoMsg(ByVal Msg As String, Optional ByVal MsgCaption As Variant, Optional ByVal HelpFile As Variant, Optional ByVal HelpTopic As Variant, Optional Critical As Variant) As Boolean



' ----------------------------------------



' Purpose: Displays a standard "information only" message.



' Accepts: Msg - text of the message



' MsgCaption - caption to display; if missing, uses "Alert"



' HelpFile - name of help file to open; if present, message box will include Help command button



' HelpTopic - help topic to open; must be present if HelpFile is present



' Critical - if True, displays a critical message box instead of a simple info message box; if missing or False, doesn't



' Returns: True



' Uses : csvAccessVersion()



' Related: csvAskQuestion()



' csvConfirmDelete()



' ----------------------------------------



Const vbMsgBoxHelpButton = 16384 ' Required ONLY for Access 97.



' ----------------------------------------



Dim DoHelp As Boolean



' ----------------------------------------



If IsMissing(MsgCaption) = True Then



MsgCaption = "Alert"



End If



If MsgCaption = "" Then



MsgCaption = "Alert"



End If



DoHelp = True



If IsMissing(HelpFile) = True Then



HelpFile = ""



DoHelp = False



End If



If HelpFile & "" = "" Then



DoHelp = False



End If



If IsMissing(Critical) = True Then



Critical = False



End If



' ----------------------------------------



csvInfoMsg = True



' ----------------------------------------



If DoHelp = True Then



If Val(csvAccessVersion()) > 8 Then



MsgBox Msg, IIf(Critical = True, vbCritical, vbInformation) + vbMsgBoxHelpButton, MsgCaption, HelpFile, HelpTopic



Else



MsgBox Msg, IIf(Critical = True, vbCritical, vbInformation), MsgCaption, HelpFile, HelpTopic



End If



Else



MsgBox Msg, IIf(Critical = True, vbCritical, vbInformation), MsgCaption



End If



End Function



Function csvAccessVersion() As String



' ----------------------------------------



' Purpose: Determines the version of the currently-executing copy of Access (msaccess.exe).



' Accepts: nothing



' Returns: the version



' Uses : nothing



' Notes : Version 8.x is Access 97; version 9.x is Access 2000.



' ----------------------------------------

csvAccessVersion = SysCmd(acSysCmdAccessVer)



End Function



Function csvOpenReport(ByVal ReportName As String, Optional ByVal Mode As Variant) As Boolean



' ----------------------------------------



' Purpose: Opens a specified report.



' Accepts: ReportName - name of the report to be opened

' Mode - either "print" or any other string; if missing, assumes "preview"



' Returns: True - successful

' False - unsuccessful



' Uses : csvInfoMsg()

' Related: csvCloseReport()

' csvOpenRemoteReport()

' ----------------------------------------

Dim Msg As String

Dim Okay As Boolean

Dim X As Boolean

' ----------------------------------------

If IsMissing(Mode) = True Then

Mode = "preview"

End If

' ----------------------------------------

On Error Resume Next

DoCmd.OpenReport ReportName, IIf(LCase(Mode) = "print", acViewNormal, acViewPreview)



Okay = (Err = 0)

Select Case Err

Case 0 ' No error.

If LCase(Mode) = "preview" Then

DoCmd.RunCommand acCmdFitToWindow

End If

Case 2501 ' The open was cancelled.

Case Else

Msg = "Unexpected error while trying to open report '" & ReportName & "':" & vbCrLf & vbCrLf & CStr(Err) & " - " & Error

X = csvInfoMsg(Msg, "csvOpenReport()")

Okay = False

End Select



On Error GoTo 0

' ----------------------------------------

csvOpenReport = Okay



End Function


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...