Link to home
Start Free TrialLog in
Avatar of Eric Sherman
Eric ShermanFlag for United States of America

asked on

Using Access/VB with WinFax

I have an Access 2k database that's used to create and send faxes to customers using WinFax.  Everything works except sometimes WinFax will open the Send dialog form/box instead of letting the faxes build in the Outbox in WinFax.  I have tried slowing down the process of passing the information from Access to Winfax to no avail.

Any help will be appreciated in trying to figure out how to stop WinFax from displaying the Send dialog box when fax information is sent to it via DDE.

Thanks,

ET Sherman
Avatar of DanielSKim
DanielSKim

Have you already checked in the documentation?

ftp://ftp.symantec.com/misc/sabu/winfax/wfxsdk.pdf
Avatar of Eric Sherman

ASKER

Thanks for the reply DanielSKim ....

The documentation relates to using WinFax's SDK.  This is an older already developed program that uses DDE (Dynamic Data Exchange) to send the fax information over to WinFax.

ET
Daniel,

I looked at the WINFax SDK and I am having a little trouble with the code.

I need to be able to create a loop that sends a report to customers. This report is run in Access/VB and can be different for each customer.  I tried to use the AddAtachment File function in the code but here I would have to first print the report to a PDF file when Access loops through the Customer table then let WinFax convert this file for faxing.  That could become time consuming considering the number of customers that receive faxes plus it seems like WinFax automatically opens Acrobat in each case during the conversion process which will not work

I am trying to make this work just like it does using DDE.  You initiate the call then let Access print the report down to the WinFax printer driver.  I am having some problems with the following code.  When I use the MakeAttachment function I can see the REPORT001.FXS, REPORT002.FXS, etc. fax files being created but the fax never makes it to the Outbox.  Plus at various times I still get the WinFax Send Dialog Form opening especially if I try to send this code through a loop to create a fax for each customer.

Does anyone have some successful VB code that could be used to loop through a table of customers and print a Access report down to the WinFax driver WITHOUT the Send Dialog form opening up.  WinFax tech support on this SDK is next to nothing and it is very time consuming to try and quess your way around it.

Set objWinFaxSend = CreateObject("Winfax.SDKSend")
objWinFaxSend.SetSubject ("Test Fax")
objWinFaxSend.SetNumber ("1234567")
objWinFaxSend.SetAreaCode ("504")
objWinFaxSend.SetTo (strSetTo)
objWinFaxSend.SetDate (strDate)
objWinFaxSend.SetTime (strTime)
objWinFaxSend.SetCompany ("ABC Company")
objWinFaxSend.AddRecipient
objWinFaxSend.SetPrintFromApp (1)
objWinFaxSend.MakeAttachment "REPORT", "C:\Program Files\WinFax\Data", 0
objWinFaxSend.Send (0)

DoCmd.OpenReport "MyReport", acViewNormal

retVal = objWinFaxSend.ShowSendScreen(0)
retVal = objWinFaxSend.Done
Ok,

Even this code has problems with the Send Screen poping up when looping through a customer table with VB to create a fax to be sent to each customer.  There have to be a way this can work without the Show Send Screen poping up.

Any help will be appreciated.....

Set objWinFaxSend = CreateObject("Winfax.SDKSend")
objWinFaxSend.SetSubject ("Test Fax")
objWinFaxSend.SetNumber ("1234567")
objWinFaxSend.SetAreaCode ("504")
objWinFaxSend.SetTo (strSetTo)
objWinFaxSend.SetDate (strDate)
objWinFaxSend.SetTime (strTime)
objWinFaxSend.SetCompany ("Some Company")
objWinFaxSend.AddRecipient
objWinFaxSend.SetPrintFromApp (1)
objWinFaxSend.AddAttachmentFile ("")
objWinFaxSend.Send (0)
objWinFaxSend.ShowSendScreen (0)

DoCmd.OpenReport "MyReport", acViewNormal

objWinFaxSend.Done
OK,

Looks like the following will work and elminates my problem.  I will post it here for the benefit of anyone else that may run into the same issue.  Basicaly this little sample/test code will loop 3 times to simulate looping through a Customer Table and create 3 faxes.  The part that was needed and my original code was missing was the section that basically DoEvents and loops until IsEntryIDReady <> 1.

This solved the problem and thanks for all input that was provided on the subject.

ET


Function TestFax()

Dim objWinFaxSend As Object
Dim strDate As String
Dim strTime As String
Dim strSetTo As String
Dim intCust As Integer
Dim intCounter As Long

intCust = 0

strSetTo = "My Customer Name"
strDate = Format(DATE , "mm/dd/yy")
strTime = Format(Now(), "hh:mm:ss")

Do While intCust < 3

Set objWinFaxSend = CreateObject("Winfax.SDKSend")
objWinFaxSend.SetSubject ("Test Fax")
objWinFaxSend.SetNumber ("1234567")
objWinFaxSend.SetAreaCode ("713")
objWinFaxSend.SetTo (strSetTo)
objWinFaxSend.SetDate (strDate)
objWinFaxSend.SetTime (strTime)
objWinFaxSend.SetCompany ("Commercial Chemical")
objWinFaxSend.AddRecipient
objWinFaxSend.SetPrintFromApp (1)
objWinFaxSend.Send (1)
objWinFaxSend.ShowSendScreen (0)

    Do While objWinFaxSend.IsReadyToPrint = 0
    DoEvents
    Loop

DoCmd.OpenReport "MyReport", acViewNormal

intCust = intCust + 1

objWinFaxSend.Done

    Do While objWinFaxSend.IsEntryIDReady(0) <> 1
    DoEvents
    Loop

Set objWinFaxSend = Nothing
DoEvents

Loop

End Function

 
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial