Emailing a form for Training based on a main roster

J

JudyT

Help!

I have a main roster with persons name and email userid's that we want to
use to notify these persons by email of a particular training. I have a form
setup in a memo form saying the name and date of the training information.

What do I need to do to accomplish this task? I did a query with just their
userids in it and that is as far a I can go. I tried doing a macro but not
sure how to do that or do I need some code behind it?

Please help.
Judy
 
J

JudyT

Okay Daniel,
Here is the issue/problem: I have a main roster with all the persons userid
which is what email uses for our network. I can do a query with all active
persons and use that query but not sure how to use it.

the suggestion that you gave makes me copy all persons email address each
time. I want ot be able to use my main roster userid field to email Is
there source code for that?
 
D

Daniel

Try something like

' ***Note: This function requires the DAO reference library to work***
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim strQryName As String 'The query/table to pull the email addresses from
Dim strRecip As String 'Listing of email addresses to send email to

strQryName = "YourQueryName"
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strQryName, , dbForwardOnly)

If Not rst.BOF And Not rst.EOF Then '*** Check if there is at least one
record
Do Until rst.EOF
strRecip = strRecip & ";" & rst![EmailAddressFiledNameFromQuery]
rst.MoveNext
Loop
End If

strRecip = Right(strRecip, len(strRecip)-1) ' remove the first ; in the string

'Call your email function/code and pass the strRecip string as an input
variable to populate the recipient list of email recipients.

--
Hope this helps,

Daniel P
 
D

Daniel

Sadly there is no pre-made code. it is a question of setting up a query to
pull the people you which to send the email to and then set up a simply loop
to add them one by one to the recipient list of your email.

Answer me this. Are you going to send the email to all the people in the
table or just a few that are return by a query of some sorts? Based on your
answer I will try to give you some code to get you started.
 
Top