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

Adapt this code to send selected report page????

Status
Not open for further replies.

SyBeerianTyGRRRR

Technical User
Jul 16, 2003
31
0
0
GB
Evening all,

Can anyone tell me how to adapt the following code to only send the report page/pages relevant to the currently visible record in my form. The code below unfortunately attaches the entire report of many pages in length and if possible i want to avoid this as it makes the e-mail message too large. I tried to point the code towards the primary key text box called [AddressID] in the hope that this would select only the current record, but this just enters the exact text "[AddressID] = 1" in the To box in Outlook. The code i currently have is as follows:

===========================================================

Private Sub MailReportbtn_Click()
On Error GoTo Err_MailReportbtn_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "rptPlmkrsInfSheet"
stLinkCriteria = "[AddressID] = " & Me.AddressID

DoCmd.SendObject acReport, stDocName, acFormatSNP, stLinkCriteria

Exit_MailReportbtn_Click:
Exit Sub

Err_MailReportbtn_Click:
MsgBox Err.Description
Resume Exit_MailReportbtn_Click

End Sub

===========================================================

Obviously "rptPlmkrsInfSheet" is the report in question. I have a text box on the form called [EmailAddress] that contains the e-mail address for the current record. I need to use Snapshot format because the report pages i am sending contain bitmap images that do not display in rtf or other formats.

Any assistance would be very gratefully received.

Thanks in advance......
 
Oh yeah and as you have probably realised by now i am a VBA novice!!!!! If you can help please dont assume too much knowledge on my part o.k.

Thank You.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top