I created a button that will generate a report in pdf format and I want the form to remain hidden but I want the outlook email to open up with the pdf report attached so that they can just enter whatever email they want to send it to and click send without even having to open up outlook. I thought the following code would work:
On Error Resume Next
DoCmd.OpenReport "WorkOrderInitialR", acViewPreview, , , acHidden
Reports("WorkOrderInitialR").Caption = "Work Order " & Me.WorkOrderID & "" & ".PDF"
DoCmd.SendObject acSendReport, "WorkOrderInitialR", acFormatPDF, , , , "Work Order " & Me.WorkOrderID & " ", , True
On Error GoTo 0
The outlook send message window pops up and you can enter an email and hit send and it goes away like it sends, but it doesn't send the email until you open outlook yourself. And the report doesn't remain hidden. A
I don't understand why. Any help would be appreciated. Thanks!
On Error Resume Next
DoCmd.OpenReport "WorkOrderInitialR", acViewPreview, , , acHidden
Reports("WorkOrderInitialR").Caption = "Work Order " & Me.WorkOrderID & "" & ".PDF"
DoCmd.SendObject acSendReport, "WorkOrderInitialR", acFormatPDF, , , , "Work Order " & Me.WorkOrderID & " ", , True
On Error GoTo 0
The outlook send message window pops up and you can enter an email and hit send and it goes away like it sends, but it doesn't send the email until you open outlook yourself. And the report doesn't remain hidden. A
I don't understand why. Any help would be appreciated. Thanks!