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!

Emailing Reports 2

Status
Not open for further replies.

tricky29

Technical User
Feb 11, 2001
41
0
0
GB
I need to be able to email a report from access 2000 that is specific to a particular record. My attempts so far send a report for each indiviual record within the database. Is this possible and if so can someone please help me with the code.

My Code: (Don't Laugh)
Function Test()


DoCmd.OpenReport "Page L - Case Summary Details", acPreview, "[Illustration ID]=(specific record number)"



DoCmd.SendObject acSendReport, "Page L - Case Summary Details", "Snapshot Format", "richard@dearlove.net", , , "Results", "Last Nights Results attached", no


End Function
 
HI

There is nothing wrong with your code as such, you ned to change the underlying query which is the rcordsource of the report to have a criteria which retricts it to the record you want, difficult to be more precise without knowing where you have the posted code etc

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
If your desire is to send a snapshot report for EVERY record in the underlying table (one record per report) try this:
Code:
Dim db as Database
Dim rst as Recordset

Set db = Currentdb()
Set rst = Reports("Page L - Case Summary Details").RecordSource
While Not rst.EOF
    DoCmd.OpenReport "Page L - Case Summary Details", acPreview, "[Illustration ID]=" & rst("Illustration ID]")
    DoCmd.SendObject acSendReport, "Page L - Case Summary Details", "Snapshot Format", "richard@dearlove.net", , , "Results", "Last Nights Results attached", no
    rst.MoveNext
Wend
rst.Close
Set db = Nothing
This code sets a recordset to be the same as the report's RecordSource. It then walks through each record in the recordset and runs the report, filtering it to only report on the current recordset's Illustrator ID. The resulting report is sent as a snapshot. It is not particularly efficient as it runs the report once for each Illustration ID, but it will get the job done.


[shadeshappy] Cruising the Information Superhighway
[sub] (your mileage may vary)[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top