S
ServiceEnvoy
I have setup a button with an event procedure behind it. I need to
edit the vba code so it will ask me which email address to use if
there is more than one email field filled. The email fields to pick
from would be: serviceremail or serviceremail2
Here is the code I currently have that works for the first email only:
Private Sub WorkOrderMissing_Click()
On Error GoTo ErrorHandler
Dim objOutlook As Object 'Outlook.Application
Dim objMailItem As Object 'Outlook.MailItem
Dim WaitingFor As String
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0)
DoCmd.RunCommand acCmdSaveRecord
WaitingFor = Me!serviceremail
With objMailItem
.To = WaitingFor
.Subject = "Missing Work Order SO# " & [WorkOrder#]
.body = "We have not received the signed work order for the
call referenced at the bottom of this message. Please make sure you
have done one of the following:" & Chr(13) & "Scan and email the work
order to: (e-mail address removed)" & Chr(13) & "or" & Chr(13) &
"Fax the signed work order to: 888-858-2846 or 817-394-4236" & Chr(13)
& Chr(13) & "No other email addresses or fax numbers are valid closing
methods." & Chr(13) & "If you think you have already sent the work
order in via one of the above methods, please resend it. I have just
looked in my database and it wasn't received. Please resend the work
order and feel free to call or email to make sure we receive it this
time." & Chr(13) & "Please remember, we must receive the signed work
order before we can close the call and pay you." & Chr(13) & Chr(13) &
[CallData] & Chr(13) & Chr(13) & "Michael Firey" & Chr(13) & "Service
Envoy, LLC" & Chr(13) & "918-398-4236" & Chr(13) &
"(e-mail address removed)" & Chr(13) & "www.serviceenvoy.com"
.display
End With
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " " & Err.Description
End Sub
edit the vba code so it will ask me which email address to use if
there is more than one email field filled. The email fields to pick
from would be: serviceremail or serviceremail2
Here is the code I currently have that works for the first email only:
Private Sub WorkOrderMissing_Click()
On Error GoTo ErrorHandler
Dim objOutlook As Object 'Outlook.Application
Dim objMailItem As Object 'Outlook.MailItem
Dim WaitingFor As String
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0)
DoCmd.RunCommand acCmdSaveRecord
WaitingFor = Me!serviceremail
With objMailItem
.To = WaitingFor
.Subject = "Missing Work Order SO# " & [WorkOrder#]
.body = "We have not received the signed work order for the
call referenced at the bottom of this message. Please make sure you
have done one of the following:" & Chr(13) & "Scan and email the work
order to: (e-mail address removed)" & Chr(13) & "or" & Chr(13) &
"Fax the signed work order to: 888-858-2846 or 817-394-4236" & Chr(13)
& Chr(13) & "No other email addresses or fax numbers are valid closing
methods." & Chr(13) & "If you think you have already sent the work
order in via one of the above methods, please resend it. I have just
looked in my database and it wasn't received. Please resend the work
order and feel free to call or email to make sure we receive it this
time." & Chr(13) & "Please remember, we must receive the signed work
order before we can close the call and pay you." & Chr(13) & Chr(13) &
[CallData] & Chr(13) & Chr(13) & "Michael Firey" & Chr(13) & "Service
Envoy, LLC" & Chr(13) & "918-398-4236" & Chr(13) &
"(e-mail address removed)" & Chr(13) & "www.serviceenvoy.com"
.display
End With
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " " & Err.Description
End Sub