I have a report that I can preview and print
And (in another form) send an email
What I would like to do is attach the report to an email.
Do I have to use docmd.OutputTo and then attach it ? And if so how ?? or can I attach it some other way?
MTIA
<Do I need A Signature or will an X do?>
Code:
Private Sub cmdPreview_Click()
On Error GoTo Err_cmdPreview_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "Report - RPC v1"
strWhere = "[Requested Date] = #" & Format(Me.cboStartDate.Value, "yyyy-mm-dd") & "#"
DoCmd.OpenReport strDocName, acPreview, , strWhere
Exit_cmdPreview_Click:
Exit Sub
Err_cmdPreview_Click:
MsgBox Err.Description
Resume Exit_cmdPreview_Click
End Sub
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "Report - RPC v1"
strWhere = "[Requested Date] >= #" & Format(Me.cboStartDate.Value, "yyyy-mm-dd") & "# "
DoCmd.OpenReport strDocName, acNormal, , strWhere
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
And (in another form) send an email
Code:
Private Sub cmdEmail_Click()
Dim Email As String
Dim ref As String
Dim header As String
Dim body As String
Dim objOutlook As Outlook.Application
Dim objEMail As Outlook.MailItem
Email = Me!cboEmailTo
ref = Me!cboStartDate
header = "FWL - User Access Request Report"
body = Me!txtComments
Set objOutlook = CreateObject("outlook.application")
Set objEMail = objOutlook.CreateItem(olMailItem)
With objEMail
.To = Email
.Subject = header & " " & ref
.body = body
.Save
.Send
End With
End Sub
What I would like to do is attach the report to an email.
Do I have to use docmd.OutputTo and then attach it ? And if so how ?? or can I attach it some other way?
MTIA
<Do I need A Signature or will an X do?>