DDE from access to winfax 8.0

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.
bobpatonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TrygveCommented:
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
bobpatonAuthor Commented:
Edited text of question
0
bobpatonAuthor Commented:
Adjusted points to 150
0
IanHinsonCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobpatonAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.