I've just done something similar where several reports are sent.
What I did was create a table called tbl_mail_recipients which had fields:
to - text (name)
address - text (e-mail address)
george_report - yes/no
supplier_report - yes/no
I then created a query [qry_george_list] on this table which returns all the
email addresses which have the field [george_report] marked as true
SELECT tbl_mail_recipients.address
FROM tbl_mail_recipients
WHERE (((tbl_mail_recipients.[george report])=True))
GROUP BY tbl_mail_recipients.address
WITH OWNERACCESS OPTION;
I then have a command button with an on_click event proceedure. The code for
this proceedure is as follows: **Note** this code it attaching the results
of a query as an Excel doc. If you just wanted to send a mail, you would
have to play with the sendobject part.
Dim rstML As New ADODB.Recordset
Dim strList As String
rstML.Open "qry_george_list", CurrentProject.Connection, adOpenStatic,
adLockReadOnly
Do Until rstML.EOF
strList = strList & rstML!address & "; " 'replace email address with
the field you use!
rstML.MoveNext
Loop
rstML.Close
Set rstML = Nothing
strList = Left(strList, Len(strList) - 2) 'cut off the last ; and Space
DoCmd.SendObject acSendQuery, "qry_george_rpt", acFormatXLS, _
strList, , , "Yesterdays Delivery Report", _
"Please find attached yesterdays delivery log" & vbCrLf & _
"" & vbCrLf & _
"Regards," & vbCrLf & _
"" & vbCrLf & _
"Brackmills Receivers", False
Regards,
Mark
"chris" <ch**********@yahoo.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I'm looking for some help on setting up a form that will send automated
e-mails through groupwise. I am a novice at codeing and really need a
cut and paste type response. I've had people in the past try and help
me, but nothing has worked thus far. I've been trying to get this to
work for several years now. I know there may be some resources (found
as a manu item when creating a module) required, but I'm not sure which
ones and how to tie them in. Here is what I need.
I will have a form set-up with fields that contain all of the
recepients of the e-mail, e-mail's addresses in them. The message will
be a standard message saying something to the effect "This task has
been completed." This can either be hard coded or I can make another
field with the message as the default. I will have a command button on
the form so that once the user hits the command button saying the task
is completed, the correct people will rec've the automated e-mail.
I would really, greatly appreciate any help or assistance some one can
provide me. I know this is not an easy task, but it is crucial to what
I want to accomplish in my database.
Thank you very much for all those who respond.
Regards,
Chris