I'm stumped on something that I've been at for a few days and so am seeking help.
I'm sending emails to managers to let them know that a performace review is due and attach a custom form for the employee referenced. I have the query working and have created the recordset. The emails are generating correctly from the recordset but I can't get the code to send the active record info over to populate a report for just the one person referenced. I keep getting the entire recordset sent over.
I've seen this problem on the boards elsewhere but I have a new twist on it as I am not driving the request from a button on a form. I'm doing the whole thing programatically.
That being said, how do I filter [EEFullName] by the current record in the recordset (when no Form is involved)?
The relevant parts of the code are below.
Many thanks!
Expand|Select|Wrap|Line Numbers
- 'Dim strLtrContent As String
- Dim rsContacts As New ADODB.Recordset
- rsContacts.ActiveConnection = CurrentProject.Connection
- rsContacts.Open "QRY12MoReviewNewMIPNo"
- 'For each record in the TblContacts table, send an email
- Do While Not rsContacts.EOF
- 'Send data for this active record to Report
- DoCmd.OpenReport "RPTPAN", acViewPreview, , "[EEFullName] = " & EEFullName
- 'output report to .pdf format and save as PAN.pdf.
- '......
- DoCmd.Close acReport, "RPTPAN", acSaveNo