Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email response

Status
Not open for further replies.

tarena

IS-IT--Management
Nov 28, 2005
70
0
0
US
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
 
How will the code know who sent the origional work order? is this in a field if so what field?

you should be able to copy this code into another button click event and then change

origionalsender=DLookup("[workorderrequesterfield]", "tablename", _
"WO_ID = '" & Me![WO_ID] & "'")

DoCmd.SendObject acSendReport, stDocName, "Snapshot Format (*.snp)", origionalsender, , , strSubject, strMessageBody, True

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top