Hello,
I am trying to add a filter to a recordset table but I am not sure how to write ir or in what part of the code.
This is my code:
What I need to do is filter by mail_Sent_Date = Null so I do not resend the same email twice. I have tried this but it did not work:
Any ideas?
Thanks in advance for your help
I am trying to add a filter to a recordset table but I am not sure how to write ir or in what part of the code.
This is my code:
Code:
[SIZE=3][FONT=Calibri]Dim RS As DAO.Recordset[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Set RS = CurrentDb.OpenRecordset("Mail_Reminder_RecordSet")[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]With RS[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]If .EOF And .bof Then 'IT MEANS THERE ARE NO RECORDS, WE ARE AT THE BEGINNING OF FILE AND END OF FILE (No Records found for this query.)[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Else[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Do Until .EOF 'DO UNTIL END OF RECORDSET FILE[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Forms![Menu2]![IncidKey] = RS!IncidKey[/FONT][/SIZE]
[FONT=Calibri][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Calibri]DoCmd.SendObject acSendReport, "report", acFormatPDF, ![Mail], , , "First Alert - High Impact Incident Notification", "This is an automatic mail notification. You have received this mail because there is a high-impact First Alert incident regarding your product line. Please refer to the attached report.", False[/FONT][/SIZE]
[SIZE=3][FONT=Calibri].Edit[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]![Mail_Sent_Date] = Now()[/FONT][/SIZE]
[SIZE=3][FONT=Calibri].Update[/FONT][/SIZE]
[SIZE=3][FONT=Calibri].MoveNext[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Loop[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]End If[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]End With[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]'CLEAN UP MEMORY AT END[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]If Not RS Is Nothing Then[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]RS.Close[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Set RS = Nothing[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]End If[/FONT][/SIZE]
Code:
RS.Filter = RS!mail_Sent_Date = Null
Any ideas?
Thanks in advance for your help