?
Solved

DDE from access to winfax 8.0

Posted on 1998-02-16
5
Medium Priority
?
366 Views
Last Modified: 2012-08-14
I have been able to automate the process of faxing using fields within VB5.0 going thru winfax8.0 but I need to be able to do it thru access95. If anyone has some code which might help it would be appreciated. I used the sample code that came with winfax8.0 to automate the process within VB5.0 but the same code will not work in access.
The code used with VB is as follows:

Sub Command1_Click ()

FAXNumber$ = "555-1212"
SendTime$ = "06:00:00"
SendDate$ = "12/25/96"
FAXName$ = "Benjamin Smith"
Company$ = "Data Processing Services"
Subject$ = "Joy of Faxing"
Keyword$ = "fax, joy"
BillingCode$ = "5905-001-xx"
Mode$ = "Fax"
CoverPage$ = "C:\DATA\WINFAX\COVERS\GENERAL.CVP"
CoverText$ = "Do enjoy this seasonal message."
Attachment$ = "C:\DATA\OTHER\XMASTREE.FXR"
'This is the start of the DDE to WinFax.
'Create the link and disable
'automatic reception in WinFax.
Label1.LinkTopic = "FAXMNG32|CONTROL"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkExecute "GoIdle"
Label1.LinkMode = 0
'Create a new link with the TRANSMIT topic.
Label1.LinkTopic = "FAXMNG32|TRANSMIT"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkItem = "sendfax"
'Start DDEPokes to control WinFax.
recip$ = "recipient(" & Chr$(34) & FAXNumber$ & Chr$(34) & "," & Chr$(34) & SendTime$ & Chr$(34) & "," & Chr$(34) & SendDate$ & Chr$(34) & ","
recip$ = recip$ & Chr$(34) & FAXName$ & Chr$(34) & "," & Chr$(34) & Company$ & Chr$(34) & "," & Chr$(34) & Subject$ & Chr$(34) & ","
recip$ = recip$ & Chr$(34) & Keyword$ & Chr$(34) & "," & Chr$(34) & BillingCode$ & Chr$(34) & "," & Chr$(34) & Mode$ & Chr$(34) & ")"
Label1.Caption = recip$
Label1.LinkPoke
'setcoverpage
Label1.Caption = "setcoverpage(" & Chr$(34) & CoverPage$ & Chr$(34) & ")"
Label1.LinkPoke
'fillcoverpage
Label1.Caption = "fillcoverpage(" & Chr$(34) & CoverText$ & Chr$(34) & ")"
Label1.LinkPoke
'attach
Label1.Caption = "attach(" & Chr$(34) & Attachment$ & Chr$(34) & ")"
Label1.LinkPoke
'showsendscreen
Label1.Caption = "showsendscreen(""1"")"
Label1.LinkPoke
'resolution
Label1.Caption = "resolution(""HIGH"")"
Label1.LinkPoke
'The SendfaxUI parameter is used only
'when a fax-ready cover page and/or
'attachments are included and you do
‘not need to print to the WinFax printer
‘driver.
Label1.Caption = "SendfaxUI"
Label1.LinkPoke
'Send the fax.
Label1.LinkTopic = "FAXMNG32|CONTROL"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkExecute "GoActive"
'Close the link between the applications.
Label1.LinkMode = 0
End Sub

All comments that were in the original helpfile with winfax8.0 have been left in. This works also if you make the fixed settings variables. I just need to be able to get it to work in Access95.
0
Comment
Question by:bobpaton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 12

Expert Comment

by:Trygve
ID: 1968500
Provide the code, if it is not to long, so we can have a look at it. Also include any error messages og symptoms other than the fact that it is not working.
0
 

Author Comment

by:bobpaton
ID: 1968501
Edited text of question
0
 

Author Comment

by:bobpaton
ID: 1968502
Adjusted points to 150
0
 
LVL 1

Accepted Solution

by:
IanHinson earned 600 total points
ID: 1968503
Here's some example code for sending a report by fax using WinFax in Access 95/97.

The report should be set up to use the WinFax printer (Delrina MAPI Services?) in its Page Setup in design mode.

The code assumes that WinFax has already been started. This is checked for by the FindWindow function. Maybe code should be included to start up WinFax automatically (using the Shell() function).

Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal IpClassName As String, ByVal IpWindowName As String)

Function SendWinFax(strFaxName As String, strFaxNumber As String, strReportName As String) As Integer
Dim lngChannelNumber As Long
Dim strFaxStatus As String
Dim FaxTime As String
Dim strRecipFaxNum As String
Dim strRecipTime As String
Dim strRecipDate As String
Dim strRecipName As String
Dim strRecipient As String

On Error GoTo SendWinFax_Error 'Error Trap

If FindWindow("Sfaxmng", "Delrina Winfax PRO") > 0 Then

' Build Recipient string to send in DDEPoke
strRecipFaxNum = Chr$(34) & strFaxNumber & Chr$(34)
strRecipTime = Chr$(34) & Format$(Now, "h:nn:ss") & Chr$(34)
strRecipDate = Chr$(34) & Date & Chr$(34)
strRecipName = Chr$(34) & Left$(strFaxName, 24) & Chr$(34)
strRecipient = strRecipFaxNum & "," & strRecipTime & "," & strRecipDate & "," & strRecipName

lngChannelNumber = DDEInitiate("faxmng32", "CONTROL")
strFaxStatus = DDERequest(lngChannelNumber, "STATUS")

'If busy then loop until not busy
While strFaxStatus Like "Busy*"
  strFaxStatus = DDERequest(lngChannelNumber, "STATUS")
Wend

lngChannelNumber = DDEInitiate("FAXMNG", "TRANSMIT")
DDEPoke lngChannelNumber, "Sendfax", "recipient(" & strRecipient & ")"
DDEPoke lngChannelNumber, "Sendfax", "showsendscreen(""0"")"
'DDEPoke lngChannelNumber, "Sendfax", "setcoverpage(""Cover Page"" )" 'Untested Other Poke examples
'DDEPoke lngChannelNumber, "Sendfax ", "fillcoverpage(""Stuff to go inside."")"
'DDEPoke lngChannelNumber, "SendFax", "resolution(""HIGH"")"

' Run the Report
DoCmd.OpenReport strReportName, A_NORMAL
SendWinFax = -1 ' setting return value to True
Else 'If WinFax is not started
 MsgBox "Please Start WinFax and try again" 'Prompt
 SendWinFax = 0 ' setting return value to False
End If

SendFax_Exit:
 DDETerminateAll 'Terminate all links.
 lngChannelNumber = False
Exit Function

SendWinFax_Error:
MsgBox "Error:" + Error$, 0, "SendFaxl"
Resume SendFax_Exit

End Function

Hope this helps.

0
 

Author Comment

by:bobpaton
ID: 1968504
Most of it worked, I was able to debug a couple of the areas that didn't work but thanks for the help it is much appreciated
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question