I'm using Access 97. I have a Work Order form with a control button on it to email our the form to certain people. Once the problem is fixed and the Work Order is closed we want a control button to send a response only to the person who sent out the original Work Order. Is there a way to do this? Below is the code that is being used to email out the original form.
Private Sub cmdEMAILSingleRecordReport_Click()
On Error GoTo Err_cmdEMAILSingleRecordReport_Click
Dim stDocName As String
Dim strSubject As String, strMainMessage As String, strAttachmentText As String
Dim strMessageBody As String
Const strQUOTE = """"
stDocName = "rptEMAILFORM_" & Me.NAME
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport stDocName, acViewPreview, , "WO_ID = " & Me![WO_ID]
strSubject = "Maintenance Work Order ID# " & Me![WO_ID]
strMainMessage = "Please review the attached Maintenance Work Order form, and respond as appropriate." & vbCr & _
vbCr & _
"Glenn Litchford"
strAttachmentText = "The attached file is a Snapshot format file, which can be viewed " & _
"with the Microsoft Snapshot viewer. If you do not already have it " & _
"installed, you can (as of 12/17/2007) obtain it for free at:" & _
vbCr & _
" & vbCr & _
"If you do not have access to the world-wide web, we can e-mail the install file to you. " & _
"The install file is about 1.7Mb in size." & vbCr & _
vbCr & _
"Snapshot Viewer is small and easy to install; only three clicks are needed."
strMessageBody = strSubject & String(2, vbCr) & strMainMessage & String(3, vbCr) & strAttachmentText & vbCr
DoCmd.SendObject acSendReport, stDocName, "Snapshot Format (*.snp)", "Glenn Litchford, Rhonda Greene, John Jackson", , , strSubject, strMessageBody, True
DoCmd.Close acReport, stDocName, acSaveNo
Exit_cmdEMAILSingleRecordReport_Click:
Exit Sub
Err_cmdEMAILSingleRecordReport_Click:
Select Case Err.Number
Case 2501 '"Action of the DoCmd was Cancelled" Error
Resume Next 'Ignore it; app shouldn't bug just because user hit Cancel button!
Case Else
MsgBox "Error #: " & Err.Number & "@" & Err.DESCRIPTION & "@ ", _
vbMsgBoxHelpButton, , Err.HelpFile, Err.HelpContext
Resume Exit_cmdEMAILSingleRecordReport_Click
End Select
End Sub
Private Sub cmdEMAILSingleRecordReport_Click()
On Error GoTo Err_cmdEMAILSingleRecordReport_Click
Dim stDocName As String
Dim strSubject As String, strMainMessage As String, strAttachmentText As String
Dim strMessageBody As String
Const strQUOTE = """"
stDocName = "rptEMAILFORM_" & Me.NAME
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport stDocName, acViewPreview, , "WO_ID = " & Me![WO_ID]
strSubject = "Maintenance Work Order ID# " & Me![WO_ID]
strMainMessage = "Please review the attached Maintenance Work Order form, and respond as appropriate." & vbCr & _
vbCr & _
"Glenn Litchford"
strAttachmentText = "The attached file is a Snapshot format file, which can be viewed " & _
"with the Microsoft Snapshot viewer. If you do not already have it " & _
"installed, you can (as of 12/17/2007) obtain it for free at:" & _
vbCr & _
" & vbCr & _
"If you do not have access to the world-wide web, we can e-mail the install file to you. " & _
"The install file is about 1.7Mb in size." & vbCr & _
vbCr & _
"Snapshot Viewer is small and easy to install; only three clicks are needed."
strMessageBody = strSubject & String(2, vbCr) & strMainMessage & String(3, vbCr) & strAttachmentText & vbCr
DoCmd.SendObject acSendReport, stDocName, "Snapshot Format (*.snp)", "Glenn Litchford, Rhonda Greene, John Jackson", , , strSubject, strMessageBody, True
DoCmd.Close acReport, stDocName, acSaveNo
Exit_cmdEMAILSingleRecordReport_Click:
Exit Sub
Err_cmdEMAILSingleRecordReport_Click:
Select Case Err.Number
Case 2501 '"Action of the DoCmd was Cancelled" Error
Resume Next 'Ignore it; app shouldn't bug just because user hit Cancel button!
Case Else
MsgBox "Error #: " & Err.Number & "@" & Err.DESCRIPTION & "@ ", _
vbMsgBoxHelpButton, , Err.HelpFile, Err.HelpContext
Resume Exit_cmdEMAILSingleRecordReport_Click
End Select
End Sub