Hi
I've adapted the following code to email a report based on the values of a query. If an individual is ticked, they will receive an email with a report attached. All goes well.... if you have the patience of a saint.
In the event that 1 person is being emailed, it takes approximately 5 seconds. Upon selecting up to 15 recipients, it'll take approx. 60 seconds.
If I populate the names directly into the VBA, it takes approximately 1 second. Is there anything that I can do to refine the process without losing the ability for the user to configure a more accessible circulation list?
I've adapted the following code to email a report based on the values of a query. If an individual is ticked, they will receive an email with a report attached. All goes well.... if you have the patience of a saint.
In the event that 1 person is being emailed, it takes approximately 5 seconds. Upon selecting up to 15 recipients, it'll take approx. 60 seconds.
If I populate the names directly into the VBA, it takes approximately 1 second. Is there anything that I can do to refine the process without losing the ability for the user to configure a more accessible circulation list?
Code:
[SIZE=3][FONT=Calibri]'Obtain email addresses from qryEmailRecipients query[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Set db = CurrentDb[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]'Set rs = db.OpenRecordset("qryEmailRecipients")[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Set rs = db.OpenRecordset("SELECT * FROM qryEmailRecipients WHERE [field1] = -1")[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Do While Not rs.EOF[/FONT][/SIZE]
[SIZE=3][FONT=Calibri] strListEmail = strListEmail & ";" & rs!EmailAddress[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]rs.MoveNext[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Loop[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]strListEmail = Mid(strListEmail, 2)[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]rs.Close[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Set rs = Nothing[/FONT][/SIZE]