manito2000
Dec 3 2008, 04:52 PM
Hello...
I have a DB where I'd like to include on the form 3 e-mail buttons...3 different e-mail recipients.
I'd like to be able to press the button and have my Outlook e-mail the person (assigned to each button) and pull the record number field and the due date field and put it in the Outlook subject line...
Is this possible? Or am I dreaming?
Manito2000
johnharveyk
Dec 3 2008, 05:07 PM
Yes. possible - I'll include some code I use which was all developed from the examples om the MSDN site. Note: you'll have to be sure that the dll's referenced are on each computer if you are distributing the app (which can be done in the wizzard with a little effort - but which I generally just copy to the appropriate drive as it's almost easier.)
stDocName = "LibbeyAddOns"
DoCmd.OpenQuery ("InventoryUpdtAddOns")
'DoCmd.OpenReport stDocName, acPreview
SendR = MsgBox("Do you wish to send this fax to the number in the Customer's file?", vbYesNo)
If SendR = 6 Then
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objFaxDoc As New FAXCOMEXLib.FaxDocument
Dim JobID As Variant
'DoCmd.SendObject acSendReport, "StatementsNOCMF", acFormatRTF, "[fax: " & Me.APFaxPhone & "]", , , , , 0 (Exchange Server Only)
DoCmd.OutputTo acSendReport, stDocName, acFormatRTF, "c:\TempFaxFile.RTF"
If Me.POFax <> "" Then
objFaxServer.Connect "XXXserver"
If Len(Me.POFax) = 10 Then
objFaxDoc.Recipients.Add ("1" & Me.POFax)
Else
objFaxDoc.Recipients.Add Me.POFax
End If
objFaxDoc.CoverPageType = fcptLOCAL
objFaxDoc.CoverPage = "C:\POCover.cov"
objFaxDoc.Body = "c:\TempFaxFile.rtf"
objFaxDoc.DocumentName = "XXXFax"
objFaxDoc.Priority = fptNORMAL
'objFaxDoc.ScheduleType = fstSPECIFIC_TIME
'objFaxDoc.ScheduleTime = Now() + 0.4
objFaxDoc.Subject = "Purchase Order Add ON"
objFaxDoc.Sender.City = "Tucson"
objFaxDoc.Sender.Company = "XXXX"
'objFaxDoc.Sender.EMail = [TempVars]![CurrentUserID] & "@XXXXX.com"
objFaxDoc.Sender.faxnumber = "XXXX"
objFaxDoc.Sender.OfficePhone = "XXXX"
objFaxDoc.Sender.Department = "Purchasing"
'JobID = objFaxDoc.ConnectedSubmit(objFaxServer) 'original MS code
Call objFaxDoc.ConnectedSubmit(objFaxServer)
'SendR = MsgBox(JobID, , "JobID")
objFaxServer.Disconnect
Else
MsgBox ("Fax # is Blank")
End If
Basically, you send the fax to a file, then calll the dll to fax the file. I have a server set up to fax & this scheme works just fine.