CC on email (1 Viewer)

rainbows

Registered User.
Local time
Today, 06:05
Joined
Apr 21, 2017
Messages
425
hi ,
I have many reports that need to be CC to many people
I have put this in my embedded macro

Code:
=DLookUp("[E-mail Address]","Contacts","[ID]=" & Nz([Assigned To],0))

is it possible that I can put a code against each contact for each report
and just call up that code in the embeded macro ?

thanks

steve
 

Ranman256

Well-known member
Local time
Today, 09:05
Joined
Apr 9, 2015
Messages
4,339
cycle thru the email list, collect the names, then put list in the .TO property:

in a form is a listbox
the list is a query of the names to send to
this cycles thru the list, collects the names, then sends the report
text boxes hold the report name, email body, and subject

Code:
sub btnSend_click()
dim vTo
dim i as integer
dim sToList as string

for i = 0 to lstBox.listcount -1
    vTo = lstBox.itemdata(i)    'get next email in listbox
    lstBox = vTo		'set the listbox to this item

    sToList = sToList & ";" & vTo    
next

   docmd.SendObject acSendReport ,txtReport,acFormatPDF, sToList,,,txtSubj,txtBody

end sub
 

Users who are viewing this thread

Top Bottom