Hello fellows:
In the code below, how can I attach an access report to mail it. Thank you in advance.
Private Sub btnSend_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = Me.txtTo
oEmail.Subject = Me.txtSubject
oEmail.Body = Me.txtBody
oEmail.Attachments.Add Me.txtAttachment.Value <-- I need to attach an access report. Not a file. But I don't know how?
With oEmail
If Not IsNull(.To) And Not IsNull(.Subject) And Not IsNull(.Body) Then
.Send
MsgBox "Email Sent!"
Else
MsgBox "Please fill out the required fields."
End If
End With
End Sub
In the code below, how can I attach an access report to mail it. Thank you in advance.
Private Sub btnSend_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Set oEmail = oApp.CreateItem(olMailItem)
oEmail.To = Me.txtTo
oEmail.Subject = Me.txtSubject
oEmail.Body = Me.txtBody
oEmail.Attachments.Add Me.txtAttachment.Value <-- I need to attach an access report. Not a file. But I don't know how?
With oEmail
If Not IsNull(.To) And Not IsNull(.Subject) And Not IsNull(.Body) Then
.Send
MsgBox "Email Sent!"
Else
MsgBox "Please fill out the required fields."
End If
End With
End Sub