emailing report pages individually (1 Viewer)

pbutler

New member
Local time
Today, 22:37
Joined
Aug 27, 2012
Messages
15
Hi all,

I have a report with one page per student (grouped by studentID). It has over 200 students/pages. I would like to email each student their relevant page (I have email addresses linked to the studentID), without having to create an individual query/report manually for each of them.

Is this doable? and if so, how?

Many thanks in advance for your help. :)

Pino
 

Trevor G

Registered User.
Local time
Today, 22:37
Joined
Oct 1, 2009
Messages
2,341
This may help in part as it should create a report for each individual then its just a case of emailing, if you can get this part to work then comeback and let us know to help with the next part. This runs from a form and also needs a combo on the form to check through the id field

Create an individual pdf document from a report

Private Sub cmdExportPDF_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyFileName As String
Dim mypath As String
Dim temp As String
mypath = "L:\Accounts to Process\" 'Adjust the path to your location
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT [InvoiceID] FROM [tblInvoices]", dbOpenDynaset) 'Change the table name as required

Do While Not rs.EOF
temp = rs("InvoiceID") 'Change field name as required

MyFileName = rs("InvoiceID") & ".PDF" 'You can explore assigning the other field names

' set form value to the Customer Name, so report will be filtered correctly

Me.cboName.Value = rs("InvoiceID") 'cboName is the combo box name on the form

' set the Me.cboName as filter for your report
DoCmd.OpenReport "rptInvoiceToProcess", acViewReport, Me.cboName
DoCmd.OutputTo acOutputReport, "", acFormatPDF, mypath & MyFileName
DoCmd.Close acReport, "Invoices to PDF"
rs.MoveNext
Loop
Set rs = Nothing
Set db = Nothing

End Sub
 

Users who are viewing this thread

Top Bottom