G
Guest
Hi there,
I am using an Send Object function to generate an email mail merge.
I am trying to put all of my contacts emails in the BCC field so that
privacy is maintained, however my function below inputs the SQL statement
into the box rather than the entire contacts address. If I use a dlookup
function instead, what with statement do I use to loop through the results.
Private Sub mailer_Click()
DoCmd.SendObject acSendNoObject, , , , , emailenq, "Subject", "Message",
True, False
End Sub
Function emailenq() As String
emailenq = "SELECT Customer_Emails_Qry.Customer_Email FROM
Customer_Emails_Qry;"
End Function
Or I try with dlookup but I get an error in the loop saying object required.
What would work here? Without the With and Loop statements it works fine, but
only returns one address (The first recordset)
With Customer_Emails_Qry
Do While Not .EOF
emailenq = DLookup("[Customer_Email]", "[Customer_Emails_Qry]",
[Customer_Email]<> ''") & ";"
Loop
Can anyone help. Either way will be fine.
Thanks
Andi
I am using an Send Object function to generate an email mail merge.
I am trying to put all of my contacts emails in the BCC field so that
privacy is maintained, however my function below inputs the SQL statement
into the box rather than the entire contacts address. If I use a dlookup
function instead, what with statement do I use to loop through the results.
Private Sub mailer_Click()
DoCmd.SendObject acSendNoObject, , , , , emailenq, "Subject", "Message",
True, False
End Sub
Function emailenq() As String
emailenq = "SELECT Customer_Emails_Qry.Customer_Email FROM
Customer_Emails_Qry;"
End Function
Or I try with dlookup but I get an error in the loop saying object required.
What would work here? Without the With and Loop statements it works fine, but
only returns one address (The first recordset)
With Customer_Emails_Qry
Do While Not .EOF
emailenq = DLookup("[Customer_Email]", "[Customer_Emails_Qry]",
[Customer_Email]<> ''") & ";"
Loop
Can anyone help. Either way will be fine.
Thanks
Andi