I am using
Code:
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
If Me.lstCategory.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 employee"
Exit Sub
End If
'add selected values to string
Set ctl = Me.lstCategory
For Each varItem In ctl.ItemsSelected
strWhere = strWhere & ctl.ItemData(varItem) & ","
Next varItem
'trim trailing comma
strWhere = Left(strWhere, Len(strWhere) - 1)
'open the report, restricted to the selected items
DoCmd.OpenReport "rptBookingEmailBatchPDF", acPreview, , "TeacherID IN(" & strWhere & ")"
DoCmd.SendObject acSendReport, "rptBookingEmailBatchPDF", "PDFFormat (*.pdf)", Me.txtEmail, , , "Booking Confirmations", , yes
DoCmd.Close acReport, "rptBookingEmailBatchPDF", acSaveNo
for each individual school it shows the title of the schools on the correct fields however as I am batch emailing one pdf to the same person any person that has the same name and school (and school id) shows up blank on the second and following pages. When it goes back to a different school in the pdf the details show correctly.
I am guessing because it is the same school I am getting blanks on the next pages - how do I get around this? I am guessing it is in the code?