Multiple email Recipients (1 Viewer)

Gismo

Registered User.
Local time
Today, 12:25
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:25
Joined
Sep 21, 2011
Messages
14,038
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:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:25
Joined
Jul 9, 2003
Messages
16,244
in VBA you would concatenate the addresses in the To property dynamically

See here:-
 

Gismo

Registered User.
Local time
Today, 12:25
Joined
Jun 12, 2017
Messages
1,298
i am getting an error

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


Set rs = CurrentDb.OpenRecordset("SELECT * FROM CustomerDeclineemails ")
 

Minty

AWF VIP
Local time
Today, 10:25
Joined
Jul 26, 2013
Messages
10,353
Does the query CustomerDeclineemails refer to any forms for criteria that aren't open or missing values?
 

Gismo

Registered User.
Local time
Today, 12:25
Joined
Jun 12, 2017
Messages
1,298
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
 

Gismo

Registered User.
Local time
Today, 12:25
Joined
Jun 12, 2017
Messages
1,298
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]));
 

Minty

AWF VIP
Local time
Today, 10:25
Joined
Jul 26, 2013
Messages
10,353
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.
 

Gismo

Registered User.
Local time
Today, 12:25
Joined
Jun 12, 2017
Messages
1,298
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
 

Minty

AWF VIP
Local time
Today, 10:25
Joined
Jul 26, 2013
Messages
10,353
Actually, I'm not sure that query makes sense, there is no comparison field for the second form criteria.
 

Minty

AWF VIP
Local time
Today, 10:25
Joined
Jul 26, 2013
Messages
10,353
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?
 

Gismo

Registered User.
Local time
Today, 12:25
Joined
Jun 12, 2017
Messages
1,298
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

Top Bottom