How to email only one page of a multi-page report

D

ddavisCOM

I am trying to email only one page of a report. I know the code to open a
report to a specific record.

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String
Dim lngRecNum As Long

lngRecNum = Me![ID]
stDocName = "rptStreetClosure"

DoCmd.OpenReport stDocName, acPreview, , "[ID] = " & lngRecNum

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

and the code to email a report:

Private Sub cmdSendReport_Click()
On Error GoTo Err_cmdSendReport_Click

Dim stDocName As String

stDocName = "rptStreetClosure"
DoCmd.SendObject acReport, stDocName, ,[email address], Etc..

Exit_cmdSendReport_Click:
Exit Sub

Err_cmdSendReport_Click:
MsgBox Err.Description
Resume Exit_cmdSendReport_Click

End Sub

but i don't know how to combine the two to get the result that i what. any
help would be appreciated.
 
D

ddavisCOM via AccessMonster.com

I've figured it out.
I am trying to email only one page of a report. I know the code to open a
report to a specific record.

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String
Dim lngRecNum As Long

lngRecNum = Me![ID]
stDocName = "rptStreetClosure"

DoCmd.OpenReport stDocName, acPreview, , "[ID] = " & lngRecNum

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

and the code to email a report:

Private Sub cmdSendReport_Click()
On Error GoTo Err_cmdSendReport_Click

Dim stDocName As String

stDocName = "rptStreetClosure"
DoCmd.SendObject acReport, stDocName, ,[email address], Etc..

Exit_cmdSendReport_Click:
Exit Sub

Err_cmdSendReport_Click:
MsgBox Err.Description
Resume Exit_cmdSendReport_Click

End Sub

but i don't know how to combine the two to get the result that i what. any
help would be appreciated.
 
T

Tony Toews [MVP]

ddavisCOM said:
I am trying to email only one page of a report.

For a page on how to print a report for a single record and how to
generate reports to attach to emails see the Emailing reports as
attachments from Microsoft Access page at
http://www.granite.ab.ca/access/email/reportsasattachments.htm

Tony

--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top