Multiple email Recipients

Gismo

Registered User.
Local time
Today, 21:18
Joined
Jun 12, 2017
Messages
1,298
Hi all,

previously, i only had to email my report to 2 recipient
i now need to be able to email multiple recipients based on a query

below is what I had before
please advise how to email multiple recipients

1610356723965.png
 
Not sure how you would do it in a macro, but in VBA you would concatenate the addresses in the To property dynamically as you have done there statically.
 
Last edited:
in VBA you would concatenate the addresses in the To property dynamically

See here:-
 
i am getting an error

Run-time Error '3061' Too Few Parameters. Expected 2​


Set rs = CurrentDb.OpenRecordset("SELECT * FROM CustomerDeclineemails ")
 
Does the query CustomerDeclineemails refer to any forms for criteria that aren't open or missing values?
 
Does the query CustomerDeclineemails refer to any forms for criteria that aren't open or missing values?
no it does not refer to any forms
all data in the query seems fine when opened manually
 
SELECT [DAW Sheet Data File].Registration, [DAW Sheet Data File].Sequence, [CSM/CSA].[e-mail] AS emailCSM, [CSM/CSA].Division, [CSM/CSA_1].[e-mail] AS emailCSA
FROM ([DAW Sheet Data File] INNER JOIN [CSM/CSA] ON [DAW Sheet Data File].CSM = [CSM/CSA].UserName) INNER JOIN [CSM/CSA] AS [CSM/CSA_1] ON [DAW Sheet Data File].CSA = [CSM/CSA_1].UserName
WHERE ((([DAW Sheet Data File].Registration)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Registration]) AND (([DAW Sheet Data File].Sequence)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Sequence]));
 
no it does not refer to any forms
all data in the query seems fine when opened manually
It does refer to forms - see the bits in Red below;

SELECT [DAW Sheet Data File].Registration, [DAW Sheet Data File].Sequence, [CSM/CSA].[e-mail] AS emailCSM, [CSM/CSA].Division, [CSM/CSA_1].[e-mail] AS emailCSA
FROM ([DAW Sheet Data File] INNER JOIN [CSM/CSA] ON [DAW Sheet Data File].CSM = [CSM/CSA].UserName) INNER JOIN [CSM/CSA] AS [CSM/CSA_1] ON [DAW Sheet Data File].CSA = [CSM/CSA_1].UserName
WHERE ((([DAW Sheet Data File].Registration)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Registration]) AND (([DAW Sheet Data File].Sequence)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Sequence]));

These are form references in the criteria.
 
It does refer to forms - see the bits in Red below;

SELECT [DAW Sheet Data File].Registration, [DAW Sheet Data File].Sequence, [CSM/CSA].[e-mail] AS emailCSM, [CSM/CSA].Division, [CSM/CSA_1].[e-mail] AS emailCSA
FROM ([DAW Sheet Data File] INNER JOIN [CSM/CSA] ON [DAW Sheet Data File].CSM = [CSM/CSA].UserName) INNER JOIN [CSM/CSA] AS [CSM/CSA_1] ON [DAW Sheet Data File].CSA = [CSM/CSA_1].UserName
WHERE ((([DAW Sheet Data File].Registration)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Registration]) AND (([DAW Sheet Data File].Sequence)=[Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Sequence]));

These are form references in the criteria.
sorry, misunderstood
it refers to the form it runs from, not a form with the same name
sorry for the confusion
 
Actually, I'm not sure that query makes sense, there is no comparison field for the second form criteria.
 
the query seems to works fine
View attachment 88180
Sorry I misread the query first time around.

In your code can you debug.print [Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Registration] to make sure that subform is available to get the value from?
 
Sorry I misread the query first time around.

In your code can you debug.print [Forms]![Menu]![StatusRegFilter].[Form]![DAWSheetStatus]![Registration] to make sure that subform is available to get the value from?
the form remains open all the time so it is available
not sure why it does this
if i hard code the registration and sequence, and remove the form reference, the error shifts to the recipient list

If Not IsNull(rs!emailCSM) Or Not IsNull(rs!emailCSA) Then
vRecipientList = vRecipientList & rs!emailCSM & rs!emailCSA & ";"
 

Users who are viewing this thread

Back
Top Bottom