Private Sub Command879_Click()
On Error GoTo Err_Command879_Click
'Isolate the correct Survey, by Survey Number
DoCmd.ApplyFilter , "SurveyNumber = " & Forms!frmTabSurvey!SurveyNumber
Pause (5)
'Kill screen updates
Call acbShowUpdates(False)
Pause (1)
'Convert each of the 4 form pages to four PDF formatted documents with fixed names
'and store those 4 fixed-name docs to the user's hard drive C:\Windows\Temp
Forms!frmTabSurvey!Page1.SetFocus
DoCmd.OutputTo acOutputForm, "frmTabSurvey", _
acFormatPDF, "C:\Windows\Temp\ElectronicSurveyPage1.pdf", False
Forms!frmTabSurvey!Page2.SetFocus
DoCmd.OutputTo acOutputForm, "frmTabSurvey", _
acFormatPDF, "C:\Windows\Temp\ElectronicSurveyPage2.pdf", False
Forms!frmTabSurvey!Page3.SetFocus
DoCmd.OutputTo acOutputForm, "frmTabSurvey", _
acFormatPDF, "C:\Windows\Temp\ElectronicSurveyPage3.pdf", False
Forms!frmTabSurvey!Page4.SetFocus
DoCmd.OutputTo acOutputForm, "frmTabSurvey", _
acFormatPDF, "C:\Windows\Temp\ElectronicSurveyPage4.pdf", False
Pause (2)
'Move the user back to page 1
Forms!frmTabSurvey!Page1.SetFocus
'Activate screen updates
Call acbShowUpdates(True)
'Pause (1)
'MsgBox "The Survey documents have been created"
Pause (3)
'create the email here
MsgBox "Starting email routine now"
Set MyOlApp = CreateObject("Outlook.Application")
MsgBox "Created Object"
Set myItem = MyOlApp.CreateItem(O1MailItem)
MsgBox "Set item as email"
myItem.Subject = "A copy of the survey you requested"
MsgBox "Add the email subject"
myItem.Body = "All 4 pages of your recent Rate Classification Survey are attached. Please let me know if I can help with anything else."
Set MyAttachments = myItem.Attachments
'myattachments.Add "c:\vwtemp\" & CntyName(x) & ".pdf" 'This line you repeat for each additional attach
MsgBox "start adding the attachments"
MyAttachments.Add "C:\Windows\Temp\ElectronicSurveyPage1.pdf" '& ".pdf"
MyAttachments.Add "C:\Windows\Temp\ElectronicSurveyPage2.pdf" '& ".pdf"
MyAttachments.Add "C:\Windows\Temp\ElectronicSurveyPage3.pdf" '& ".pdf"
MyAttachments.Add "C:\Windows\Temp\ElectronicSurveyPage4.pdf" '& ".pdf"
MsgBox "attachments added"
'DoCmd.ApplyFilter , "SurveyNumber = " & Forms!frmTabSurvey!SurveyNumber
myItem.to = Forms!frmTabSurvey!!TabCtl0![Employer E-Email]
'myItem.to = Forms!frmTabSurvey![employer email] 'Rst1.Fields("email") 'Here is the email address
'myItem.deleteaftersubmit = True 'don't keep a copy in the sent file
myItem.Send
exit_command879_click:
Exit Sub
Err_Command879_Click:
MsgBox err.Description
Resume exit_command879_click
End Sub
I added the tab number thinking that may be it, but no- just a different error message about lets and gets