How to send fax from ACCESS 03?
am 17.10.2007 09:27:11 von S J Sia
I have read through past records, but no one seem to have a good
solution to use access to sent out faxes seamlessly. However, those
that I read was dated few years back. Anyone have good solution?
I am tried:
DoCmd.SendObject acReport, "FaxDocu", acFormatRTF, "[fax: " & [FaxNum]
& "]", , , , , False
but it send my FaxDocu as an attachment via email... and of course
with an invalid recipient.
help pls.
Re: How to send fax from ACCESS 03?
am 17.10.2007 10:16:44 von DFS
As far as Im aware there is no way to do it seamlessly without thirdy party
software...
I once tried it with symantec winfax pro....here is a big long function, Im
not sure if it works correctly but its close...I think I had some issues
that I never got time to sort out.....they have a fairly decent SDK with
documentation and stuff...its a good product that one...
Function winFaxDocument(documentType As faxDocumentType, _
strDocumentFilename As String, _
strDocumentParameters As String, _
strToCompanyName, _
strFromCompanyName, _
strToFaxNumber, _
blnIncludeCoverSheet, _
strCoverSheetSubject, _
strCoverSheetText, _
blnShowPreview, _
maxRetryAttempts) As Variant
'returns -1 on a failed fax attempt
Dim strMessage As String
'requires winfax reference set (tools-->references)...no it doesnt!
Set objWinFaxSend = CreateObject("WinFax.SDKSend8.0")
objWinFaxSend.SetDeleteAfterSend 1 '1-Yes, 0-No
objWinFaxSend.SetResolution 1 '1-Fine, 0-Standard
If blnIncludeCoverSheet Then
objWinFaxSend.SetQuickCover 1 '1-Yes, 0-No
objWinFaxSend.SetUseCover 1 '1-Yes, 0-No
objWinFaxSend.SetSubject strCoverSheetSubject
objWinFaxSend.SetCoverText strCoverSheetText 'Set the cover page
text if required 'Comment out or it tries to use it
Else
objWinFaxSend.SetQuickCover 0 '1-Yes, 0-No
objWinFaxSend.SetUseCover 0 '1-Yes, 0-No
objWinFaxSend.SetSubject ""
End If
If blnShowPreview Then
objWinFaxSend.SetPreviewFax 1 '1-Yes, 0-No
Else
objWinFaxSend.SetPreviewFax 0 '1-Yes, 0-No
End If
objWinFaxSend.SetTo strToCompanyName 'The name of the recipient
objWinFaxSend.SetCompany strFromCompanyName
objWinFaxSend.SetNumber strToFaxNumber
objWinFaxSend.ShowSendScreen 0 '1-Yes, 0-No
objWinFaxSend.ShowCallProgess 0 '1-Yes, 0-No
objWinFaxSend.SetPrintFromApp 1 '1-Yes, 0-No
objWinFaxSend.AddRecipient ' Add the recipient
objWinFaxSend.send (1) '1 = return event Id
objWinFaxSend.SetHold (1) 'Hold it in the inbox
'Pop up a box showing the status of the fax
'The box should have a cancel button on it to cancel the fax in progress
strMessage = ""
strMessage = strMessage & "SENDING FAX TO" & vbCrLf
strMessage = strMessage & "" & vbCrLf
strMessage = strMessage & "Company Name:" & strToCompanyName & vbCrLf
strMessage = strMessage & "Fax Number:" & strToFaxNumber & vbCrLf
arg = MBox1ChoiceUnmodalStart(strMessage, "Cancel", "FAXING
DOCUMENTS...")
'wait until "IsReadyToPrint" returns a Non-zero value (ready)
Do While objWinFaxSend.IsReadyToPrint = 0
DoEvents
Loop
'Send the print job to the winfax printer driver
Select Case documentType
Case fdtWordDocument
Set objWord = New Word.Application
objWord.Documents.Open strDocumentFilename
'objWord.ActiveDocument.PageSetup.Orientation =
wdOrientLandscape 'Set to landscape option
OldPrinter = objWord.Application.ActivePrinter 'get old printer
seting
objWord.ActivePrinter = getPrinterTarget(ptFax)
objWord.PrintOut ' print the current document in Word to WinFax.
Case fdtTextfile
'not functional yet
Case fdtReport
Call printReport(strDocumentFilename, strDocumentParameters,
ptFax, 1)
End Select
'Wait until the EntryID is ready before moving on.
Do While objWinFaxSend.IsEntryIDReady(0) <> 1
DoEvents
Loop
'Now that the entry id is ready, get the id
id = objWinFaxSend.getEntryId(0)
'The document has finished printing so close off the document
'This is primarily split from the other part because in some instances
we have to make sure it has finished printing before closing down the app.
i.e. Bugs were occuring, this solves it.
Select Case documentType
Case fdtWordDocument
objWord.ActivePrinter = OldPrinter ' Set Printer back to
original settings.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Close temp file and set winfax object instance to nothing
objWord.Quit SaveChanges:=wdDoNotSaveChanges ' Close instance of
MS Word
Set objWord = Nothing
Case fdtTextfile
'not functional yet
Case fdtReport
'No closure necessary
End Select
'Clean up winfax send object and close object
'objWinFaxSend.Done
'Set objWinFaxSend = Nothing
'Now wait until the fax is completed or fails. Strictly this should be
in another function but this isnt the first dodgy code ive ever done.
Set logObj = CreateObject("WinFax.SDKLog")
es = EVENTSTATUS_UNKNOWN
retries = 0
Do While Not (es = EVENTSTATUS_COMPLETE Or es = EVENTSTATUS_FAILED Or
retries >= maxRetryAttempts)
DoEvents
es = logObj.getmessageStatus(id)
retries = logObj.getMessageRetries(id)
Loop
'For time out function, this quick stab didnt work, fix another day...
'timeout = Now
'If es = EVENTSTATUS_PENDING And DateDiff("s", timeout, Now) > 60 Then
' es = EVENTSTATUS_FAILED
'End If
'If the fax failed or exceeded retry attempts delete the message
If es = EVENTSTATUS_FAILED Or retries >= maxRetryAttempts Then
logObj.deleteEventAndFiles (id)
id = -1
End If
'write the results to the fax log
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSql = "tblCRMfaxLog"
rs.Open strSql, CurrentProject.Connection, adOpenDynamic,
adLockPessimistic
rs.AddNew
rs!faxNumber = strToFaxNumber
rs!dateTimeStamp = Now()
If Not id = -1 Then
rs!wasSuccessful = True
Else
rs!wasSuccessful = False
End If
rs!winFaxEventId = id
rs.Update
rs.Close
Set rs = Nothing
'return the winfax event id (-1 if it failed)
winFaxDocument = id
'Note if bugs or weird stuff happens, maybe look into winfax
leaveRunning function
End Function
"S J Sia" wrote in message
news:1192606031.960712.303130@k35g2000prh.googlegroups.com.. .
>I have read through past records, but no one seem to have a good
> solution to use access to sent out faxes seamlessly. However, those
> that I read was dated few years back. Anyone have good solution?
>
> I am tried:
> DoCmd.SendObject acReport, "FaxDocu", acFormatRTF, "[fax: " & [FaxNum]
> & "]", , , , , False
>
> but it send my FaxDocu as an attachment via email... and of course
> with an invalid recipient.
>
> help pls.
>
Re: How to send fax from ACCESS 03?
am 17.10.2007 15:01:48 von Ken Snell
If you have a Fax device installed as a printer on your computer, you can
print the report to that fax printer.
--
Ken Snell
"S J Sia" wrote in message
news:1192606031.960712.303130@k35g2000prh.googlegroups.com.. .
>I have read through past records, but no one seem to have a good
> solution to use access to sent out faxes seamlessly. However, those
> that I read was dated few years back. Anyone have good solution?
>
> I am tried:
> DoCmd.SendObject acReport, "FaxDocu", acFormatRTF, "[fax: " & [FaxNum]
> & "]", , , , , False
>
> but it send my FaxDocu as an attachment via email... and of course
> with an invalid recipient.
>
> help pls.
>
Re: How to send fax from ACCESS 03?
am 17.10.2007 22:42:35 von jvitti
I've done ththis a long time ago sending via email. Our email server
also has software on it that allowed faxes to be send via email. Using
the SendObject comd and putting a fax number instead of an email
address the software would route the email to a fax server and fax the
attached document. Unforntunately this was a long time ago and I
cannot recall what software was used on the email server to accomplish
this.
Try doing a google search on: fax using email
This may help
On Oct 17, 3:27 am, S J Sia wrote:
> I have read through past records, but no one seem to have a good
> solution to use access to sent out faxes seamlessly. However, those
> that I read was dated few years back. Anyone have good solution?
>
> I am tried:
> DoCmd.SendObject acReport, "FaxDocu", acFormatRTF, "[fax: " & [FaxNum]
> & "]", , , , , False
>
> but it send my FaxDocu as an attachment via email... and of course
> with an invalid recipient.
>
> help pls.