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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an Access Report as an attachment through code

Status
Not open for further replies.

AccessUser22

Technical User
Joined
Jan 23, 2003
Messages
168
Location
US
I have my database set up to send outlook emails with the click of a button. However, I now need to attach an access report to these emails. Is there any way to make an attachment without having to first run the report and save it externally and then point to it through the code?

The basic email code I've been using is as follows:

Private Sub cmdSendtoCoord_Click()
Dim otlApp As Outlook.Application
Dim otlItem As Outlook.MailItem
Dim strRecip As String
Dim strRecipCC As String

Set otlApp = New Outlook.Application
Set otlItem = otlApp.CreateItem(olMailItem)

If (IsNull(Forms!frmpo!cboCoordID.Column(6))) Then
MsgBox "Please assign a coordinator and confirm" & vbCrLf & _
"the coordinator's email address" & vbCrLf & _
"prior to attempting email notification."
Else
strRecip = Forms!frmpo!cboCoordID.Column(6)
strRecipCC = ""

otlItem.To = strRecip
otlItem.CC = strRecipCC
otlItem.Subject = "Report for ID #" & Me.IDNo & " - Please Expedite Request"
otlItem.Body = "Attached is the Report for the above referenced ID Number." & vbCrLf & vbCrLf & _
"Please return signed to IT/Operations via fax."
otlItem.Display
End If

Set otlItem = Nothing
Set otlApp = Nothing
End Sub

Any info would be appreciated. Thanks [hourglass]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top