Page updated 09/27/2010
The routine mentioned in these web pages is obsolete. It was built in Access 2.0 days when this was the only approach.
Instead use Ole automation, which works with Winfax Pro 8 and later. Symantec's Winfax Pro Software Development Kit has the sample code required.
Software Development Kit
FaxDB.zip and Fax2K.zip used with WinFax Pro this can be incorporated into an Access 97 or Access 2000 app.
Access Archon Columns from Woody's Office Watch See 112. Faxing from Access using WinFax with DDE
The following subroutine is my version of faxing reports via Winfax. However the following mentioned book, in addition to having lots of sample code has much better Winfax routines. (In my defense let me state that the following code was likely my very first venture into batch programming in Access Basic!)
MS Access 2.0 How-To CD, by Getz, Feddema, et al, pub Waite Group, ISBN 1-878739-93-x. Among many other practical tips it has ten pages and sample MDB on the CD explaining everything you need to interface via DDE to Winfax Pro.
The concept is that you tell Winfax Pro the phone number and other information via DDE commands. The next report sent to the Winfax Pro printer will then be sent with that previously DDE'd info.
It has been pointed out (unfortunately I misplaced the email otherwise I'd credit the individual who spent several frustrating hours) that if you are using Access 2.0 you can't send DDE commands to Winfax 7.0 and vice versa. In other words 16 bit and 32 bit versions of software can't communicate via DDE. The error message is roughly "DDE conversation ended data change."
However Ron L Stanley email@example.com disagrees. He states "faxing from V2 in w95 to WinFax Pro V7 using DDE does work! I have one of my clients with 3 telesales staff using it daily. As you mention the basics also work with WinFax LITE."
Trevor Best, one of the comp.database.ms-access newsgroup's past resident expert, (where does he get the time to be so helpful and when will his boss purchase him a better system?) has indicated that all the versions of Winfax Lite he has encountered do have the DDE logic built in even though the manuals ignore it. However your mileage may vary.
Dim error_code As Integer ' This subroutine ' cycles through each contact; ' Reading the Organization and Fax Number; ' DDE's the Organization and Fax Number to Winfax Pro ' Run's the customized report for that contact ' which is then scheduled for faxing to that contact. ' The customized report can be any combination of League Stats. ' All problems, and A Specific Team's problems Dim MyDB As Database Dim FaxContacts As Recordset Dim LeagueID As Recordset Dim Chan As Variant Dim MsgBoxOut As String Dim I MsgBoxOut = "Click OK only if you have just exited and re-entered Windows. If you do not, you run the risk of terminating your fax run abnormally as you may run out of Windows resources!" If (MsgBox(MsgBoxOut, 305) = 2) Then Exit Sub Set MyDB = DBEngine.Workspaces(0).Databases(0) Set LeagueID = MyDB.OpenRecordset("League ID") ' Startup WinFax Pro On Error Resume Next 'Establish Fax Link if WinFax Pro already running Chan = DDEInitiate("faxmng", "Transmit") ' If error occurs, Winfax isn't running. If Err Then
' If error occurs then Winfax Pro not found On Error GoTo WinFaxNotFound ' So start WinFax Pro I = Shell(LeagueID.[li Win Fax Pro Path] & "FAXMNG.EXE", 6) On Error GoTo 0 Chan = DDEInitiate("faxmng", "Transmit") ' Establish Fax link.
End If ' * * * * * * * * * * * * * * * * * * * * * * * * * * Set FaxContacts = MyDB.OpenRecordset("Fax - All except Team Stats") ' Read the first Team Faxing Record FaxContacts.MoveFirst Do Until FaxContacts.EOF
' Tell Winfax who this fax is going to DoEvents DDEPoke Chan, "Fax Number", FaxContacts.[c Contact Fax Number] DDEPoke Chan, "Receiver", FaxContacts.[c Organization] DoEvents DoCmd OpenReport "Fax - 0 Master", , , "[c Contact ID] = " & FaxContacts.[c Contact ID] DoEvents FaxContacts.MoveNext
Loop ' * * * * * * * * * * * * * * * * * * * * * * * * * * DDETerminateAll ' Terminate all links. MsgBox ("The faxes have been generated and sent to WinFax Pro for transmission. View the WinFax Pro Send log to moniter and confirm their status.") DoCmd Close Exit Sub WinFaxNotFound: MsgBox "WinFax Pro not found. Please correct the drive and path in the League ID information and retry.", 16 Exit Sub
Return to Tony's Main Access page.
Auto FE Updater distribute new and updated Front End databases to your users with several mouse clicks.
Granite Fleet Manager - the best designed fleet maintenance tracking and management system available
Website copyright © 1995-2013 Tony Toews