S
scadav
Within a module, I have the following:
Public Function SendEmail(sClient As String, sDateRequested As String,
sWorkOrderComments As String, sWorkOrderNumber As Integer,
sWorkOrderStatus As String)
On Error GoTo Err_SendEmail
'Check to see if sending an email is enabled Dim sSendEmail As
String sSendEmail = DLookup("[ParameterValue]",
"sys_SystemParameters", "[ParameterID] = 2")
If (sSendEmail = 1) Then
outText = "A NEW WORK ORDER WAS JUST CREATED IN THE SYSTEM" &
vbCrLf & vbCrLf outText = outText & "Client: " & sClient &
vbCrLf outText = outText & "Date Needed: " & sDateRequested &
vbCrLf outText = outText & "Description: " & sWorkOrderComments
& vbCrLf
toList = sRetreiveEmails Esubject = "RSED: (" & sWorkOrderNumber
& ") " & sWorkOrderStatus & " - " & sClient
DoCmd.SendObject acSendNoObject, , acFormatTXT, toList, ccList,
, Esubject, outText, True
End If
Exit_SendEmail:
Exit Function
Err_SendEmail:
MsgBox Err.Description Resume Exit_SendEmail
End Function
I have this within a module because I call it from several places with
the db, but if a user closes the outlook window, it gives me the
SendObject action error.
Is there a problem with error hanlding within modules? Anyway I can
prevent this message in the event the user decides not to send the
email?
Thanks
Public Function SendEmail(sClient As String, sDateRequested As String,
sWorkOrderComments As String, sWorkOrderNumber As Integer,
sWorkOrderStatus As String)
On Error GoTo Err_SendEmail
'Check to see if sending an email is enabled Dim sSendEmail As
String sSendEmail = DLookup("[ParameterValue]",
"sys_SystemParameters", "[ParameterID] = 2")
If (sSendEmail = 1) Then
outText = "A NEW WORK ORDER WAS JUST CREATED IN THE SYSTEM" &
vbCrLf & vbCrLf outText = outText & "Client: " & sClient &
vbCrLf outText = outText & "Date Needed: " & sDateRequested &
vbCrLf outText = outText & "Description: " & sWorkOrderComments
& vbCrLf
toList = sRetreiveEmails Esubject = "RSED: (" & sWorkOrderNumber
& ") " & sWorkOrderStatus & " - " & sClient
DoCmd.SendObject acSendNoObject, , acFormatTXT, toList, ccList,
, Esubject, outText, True
End If
Exit_SendEmail:
Exit Function
Err_SendEmail:
MsgBox Err.Description Resume Exit_SendEmail
End Function
I have this within a module because I call it from several places with
the db, but if a user closes the outlook window, it gives me the
SendObject action error.
Is there a problem with error hanlding within modules? Anyway I can
prevent this message in the event the user decides not to send the
email?
Thanks