Emailing

  • Thread starter Thread starter ivan grozney
  • Start date Start date
I

ivan grozney

I have a database where the user can input the email
address of the requestor. It also allows then to have a
preference flag for email over snail mail. I set up the
DoCmd.SendObject but I cannot figure out how to get the
list of email addresses into the TO field.

Do I need to somehow connect the users CONTACTS list to
ACCESS so that they can make a DL? I have no idea how to
do that (if it can be done). Alternatively, I have no
clue as to how to create a "list" of addresses from the
database that I can substitute into the TO field into
DOCMD.SENDOBJECT

tia
Ivan
 
Your question is not clear enough!!
you want the address list from your database or outlook??
do you want to send the same message to all people in the address list
Please clearify!!

MCP - Access and SQL Serve

----- ivan grozney wrote: ----

I have a database where the user can input the email
address of the requestor. It also allows then to have a
preference flag for email over snail mail. I set up the
DoCmd.SendObject but I cannot figure out how to get the
list of email addresses into the TO field.

Do I need to somehow connect the users CONTACTS list to
ACCESS so that they can make a DL? I have no idea how to
do that (if it can be done). Alternatively, I have no
clue as to how to create a "list" of addresses from the
database that I can substitute into the TO field into
DOCMD.SENDOBJEC

ti
Iva
 
Ivan,

You can enter data into the SendObject statement like this

Dim strToAddress As String
strToAddress = "(e-mail address removed)"
DoCmd.SendObject acSendNoObject,,, strToAddress, "FromAddress",,"Subject",
"Message Text"

What you have to do is read through the list of contacts in the database and
set strToAddress for each one.
You can also use string variables to replace any of the other string
constants I have used above.


This example uses DAO syntax (default for Access97). It would have to be
changed a little if you use ADO (default for 2000 & XP).

Dim rs As RecordSet
Dim strSQL As String
Dim strToAddress As String

strSQL = "Select EmailTo From ContactsTable Where EmailPreference=True" '
change the object names appropriately
Set rs = CurrentDB.OpenRecordset(strSQL)
Do While Not rs.EOF
strToAddress = rs!EmailTo
DoCmd.SendObject acSendNoObject,,, strToAddress,
"FromAddress",,"Subject", "Message Text"
Loop
rs.Close
Set rs = Nothing


Rod Scoullar
 
You want to get the address list from MS Outlook or a table from Database
you want to send the same message to all people from address list
Please Specify!!

MCP - Access and SQL Serve
----- ivan grozney wrote: ----

I have a database where the user can input the email
address of the requestor. It also allows then to have a
preference flag for email over snail mail. I set up the
DoCmd.SendObject but I cannot figure out how to get the
list of email addresses into the TO field.

Do I need to somehow connect the users CONTACTS list to
ACCESS so that they can make a DL? I have no idea how to
do that (if it can be done). Alternatively, I have no
clue as to how to create a "list" of addresses from the
database that I can substitute into the TO field into
DOCMD.SENDOBJEC

ti
Iva
 
Edmund,

Sorry it was not clear.

Currently the addresses are stored in the db. I would
like to use them from there and create the e-mails.

I didn't know if I could do that. So the other part
was if I cannot do it that way, is there a way to link the
email addresses in my database to an outlook contacts list
and send the emails that way.

I hope this makes it clearer.

Ivan
 
Rod,

Thanks, I'll give it a shot. I got tunnel vision I
guess as I was trying to figure out how to get all the
addresses and put the ; between them for the TO: line of
the SendObject. Now that I see your example it seems so
obvious.

On a side note, do you know how to link the address
the users type into the system to a contacts list in
outlook?

Thanks again, I appreciate it!

Ivan
-----Original Message-----
Ivan,

You can enter data into the SendObject statement like this

Dim strToAddress As String
strToAddress = "(e-mail address removed)"
DoCmd.SendObject acSendNoObject,,,
strToAddress, "FromAddress",,"Subject",
 
Not quite sure what your problem is. What you have to do is pass the output
from a recordset (ie. the email address) to the
dosend command The code below would probably work fine


rs.Open aSQL, currCon, adOpenForwardOnly
rs.MoveFirst
Do While Not rs.EOF
aEmail = rs("email")
DoCmd.SendObject acSendReport, stDocName, acFormatRTF, aEmail, , ,
"Les Rues demandée", aMessage, False
rs.MoveNext
Loop

I don't think there is any problem with this kind of nesting

John S
Aylmer, PQ
 
Back
Top