hortizjr59
Registered User.
- Local time
- Today, 15:53
- Joined
- Sep 6, 2011
- Messages
- 30
I was wondering if any one could help with the following:
I have an access report that is populated from a query I set up.
The form I created that populates the record has a command button. When you click the button the record you are updating opens outlook and places the (record) report in the body of an email. What I was looking to do next was to add a link in the report that when clicked on would open the database and record number for the email recepient to update. The code that opens outlook and places the report in the body of the email is as follows:
Private Sub Command135_Click()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
stDocName = "ReportEmailNoticeofAssigned"
stFilename = "O:\Quality\CAPA\EmailReports\myreport.html"
strWhere = "[Improvement No] = " & Me.[Improvement No]
DoCmd.OpenReport "ReportEmailNoticeofAssigned", acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, stDocName, acFormatHTML, stFilename
DoCmd.Close acReport, stDocName
Open "O:\Quality\CAPA\EmailReports\myreport.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
End Sub
Is this possible.
Thanks for any help.

I have an access report that is populated from a query I set up.
The form I created that populates the record has a command button. When you click the button the record you are updating opens outlook and places the (record) report in the body of an email. What I was looking to do next was to add a link in the report that when clicked on would open the database and record number for the email recepient to update. The code that opens outlook and places the report in the body of the email is as follows:
Private Sub Command135_Click()
Dim strline, strHTML
Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Set OL = New Outlook.Application
Set MyItem = Outlook.Application.CreateItem(olMailItem)
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
stDocName = "ReportEmailNoticeofAssigned"
stFilename = "O:\Quality\CAPA\EmailReports\myreport.html"
strWhere = "[Improvement No] = " & Me.[Improvement No]
DoCmd.OpenReport "ReportEmailNoticeofAssigned", acViewPreview, , strWhere
DoCmd.OutputTo acOutputReport, stDocName, acFormatHTML, stFilename
DoCmd.Close acReport, stDocName
Open "O:\Quality\CAPA\EmailReports\myreport.html" For Input As 1
Do While Not EOF(1)
Input #1, strline
strHTML = strHTML & strline
Loop
Close 1
' If OL2002 set the BodyFormat
If Left(OL.Version, 2) = "10" Then
MyItem.BodyFormat = olFormatHTML
End If
MyItem.HTMLBody = strHTML
MyItem.Display
End Sub
Is this possible.
Thanks for any help.
