pbaldy, you provided me with some inspirational thinking and I can't thank you enough!!!
I changed the strFilterEmail line from "*.pdf" to Lrs!OrderID & ".pdf" and the correct attachments now attach to each email. My full working for anyone else out there is:
Dim strSql
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Dim Lrs As DAO.Recordset
Dim Outlook
Dim rng
Dim OutApp As Object
Dim OutMail As Object
strRptName = "CompleteLintelsInvoiceBATCHTESTCOPY"
strSql = "SELECT * FROM zzqryTrialInvoiceBATCHTESTCOPY ORDER BY zzqryTrialInvoiceBATCHTESTCOPY.OrderID"
Set Lrs = db.OpenRecordset(strSql, dbOpenSnapshot)
With Lrs
Do While Not Lrs.EOF
'Must open the invoice in Preview mode
DoCmd.OpenReport strRptName, acViewPreview, , "[OrderID]=" & ![OrderID]
'Debug.Print ("OrderID: " & MyRS!OrderID & " Qty " & MyRS!Qty)
DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, "C:\TempInvoicePDF\" & ![OrderID] & ".pdf"
DoCmd.Close acReport, strRptName, acSaveNo
strpath = "C:\TempInvoicePDF\"
strFilterEmail = Lrs!OrderID & ".pdf"
strFile = Dir(strpath & strFilterEmail)
Outlook = Outlook + Lrs("EmailAddress")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = Lrs!EMailAddress
'.CC = ""
'.BCC = ""
.Subject = "Test Invoice" & " " & Lrs!OrderID
.HTMLBody = "Test Invoice" & " " & Lrs!OrderID
.Attachments.Add strpath & strFile
'.Display
.Send
End With
Lrs.MoveNext
Loop
End With
Lrs.Close
On Error GoTo 0
Set Lrs = Nothing
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Emails sent OK"
End Sub
Using this method generates tbe Outlook Security warning but you can treat that with using the third party software (ClickYes Pro 2010).
But I wish I could have got this working with CDO!!!!!