Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send email from a field containing email addresses. 5

Status
Not open for further replies.

PCM

Technical User
Jan 26, 2000
3
CA
I am very new to Access, so excuse me if this is a very basic question. I am trying to send email to all email addresses that appear in a field called email address. That is, the record in the field is the destination. This would happen on the pressing of a button on a form. Can anyone point me in the right direction?
 
Yep Several ways<br>
Are you sending a report? <br>
Now you have to have created a Report already.<br>
If so<br>
Open your form in design view<br>
Add an new command button<br>
Click “Report Operations” in the “categories” list<br>
Click “Mail Report” in the “Actions” list<br>
Click NEXT button (at bottom)<br>
Click on your report in list <br>
Click NEXT button<br>
Pick a button image or name<br>
Click NEXT button<br>
Finish prompts<br>
<br>
OR In code<br>
Get to know the docmd. Command<br>
DoCmd.SendObject acSendQuery, &quot;MyQuery&quot;, acFormatTXT, Me!E-mailTextBox, , , &quot;Subject goes here&quot;, &quot;Extra message text here&quot;, False<br>
You have lots of options with DoCmd.SendObject<br>
I use this code method a lot.<br>
I made one that looks at an Order to see if its shipping “RED” if so then send an e-mail to Plant Manager so he can follow up <br>
with it to make sure it goes out.<br>
This has saved us and our distributors and their customers many missed shipments.<br>

 
Thanks DougP. I have tried both methods, but there is some functionality that I am missing. Say my query or report produces a list of ten people and email addresses with overdue accounts. I would like to be able to press a button on the form that will send each of them an email message (the same message). That is, I would lke to use the EmailAddress column as the source for the [,to] argument in the DoCmd.SendObject Method. Thanks for pointing me to the DoCmd. It looks like it is going to come in handy!
 
if your text box has several e-mails how are they separated by commas or semi colons or....<br>
you can send each person an e-mail by using a for-next loop<br>
<br>
for a = 1 to number-of-emails<br>
docmd.sendobject blah blah blah <br>
next<br>
<br>
this is vague but your &quot;TO&quot; in the docmd line is a variable<br>
which changes everytime the for-next goes around<br>
The difficultly comes in when you try to move thru the e-mails in a text box<br>
if your e-mials are separatd by commas it may pass then whole bunch in one docmd line<br>
i.e. <A HREF="mailto:Sally@my.com">Sally@my.com</A>,<A HREF="mailto:jessy@your.com">jessy@your.com</A>,<A HREF="mailto:myboy@who.com">myboy@who.com</A> etc.<br>
try this by making a dummy with people in your building<br>
or add your self 5 times you should get 5 e-mails<br>
<A HREF="mailto:me@me.com">me@me.com</A>,<A HREF="mailto:me@me.com">me@me.com</A>,<A HREF="mailto:me@me.com">me@me.com</A>,<A HREF="mailto:me@me.com">me@me.com</A><br>
<br>
If e-mails are in a list box or recordset it is much easier to pick each e-mail out. Cause you do a Movenext in a recordset or use the list1.index(a) for a list box.<br>
<br>
look up this in Help<br>
&quot;ItemsSelected Collection Example&quot; for a list box routine<br>
<br>
Give us some code and we'll patch-er up for you<br>
<br>

 
Thanks DougP. I will work on it and see what I come up with on my own. I was hoping that it wouldn't involve too much code.
 
Doug,<br>
<br>
Do you know how to attach external files to messages? I tried to add file name to Send.Object's objectname argument but no luck. A file saved in database's OLE Object field didn't work either. <br>
<br>
My goal is to make a automatic financial report mailer but reports are in various Access, Excel and Word files. Any hints?<br>
<br>
Al<br>
<br>

 
I had no luck as well.<br>
you can however add a lot of text in the Message portion of the docmd. as shown below<br>
<br>
DoCmd.SendObject acSendQuery, &quot;MyQuery&quot;, acFormatTXT, Me!E-mailTextBox, , , &quot;Subject goes here&quot;, message , False<br>
<br>
In the above code piece &quot;message&quot; variable<br>
I use something like this<br>
message = message & &quot;this is my message&quot; & chr$(10) '&lt; line feed<br>
message = message & &quot;here is some more&quot;<br>
you can add a lot of these<br>
<br>
<br>
<br>

 
Also if you are using Outlook as your e-mail program Not Express the full versions<br>
Outlook 2000 is of course the most capable<br>
'97 & '98 have add ons that allow interaction with Access<br>
----------------------------- here is a site which may help<br>
<br>
<A HREF=" TARGET="_new"><br>
Before you can use DAO to gain access to Microsoft Exchange Client or Outlook data, you must install the Microsoft Jet Exchange installable ISAM. Although you can install the Microsoft Jet Exchange installable ISAM using the Dataacc.exe file that is included in the Microsoft Office 97 Value Pack, that version of the driver does not register itself and has certain limitations. To install the most current version of the driver, download and run Wzmapi80.exe to install the Microsoft Exchange and Outlook Wizard. This installs and registers the most current version of Msexch35.dll so you can use it from DAO, and also installs the Microsoft Exchange and Outlook Wizard so you can import and link Microsoft Exchange and Outlook data using the Microsoft Access user interface.<br>
<br>
<br>
find Wzmapi80.exe at:<br>
<A HREF=" TARGET="_new">
 
I need to individually email updated lists to my teachers, each week. Help! Email messaging is my absolute blind spot. Have Teachers-email addresses in an Access table, along with a table of 67,000 students. Also have an Access query which builds the week's class list, and a report to list the kids for each class. Have floundered around in Access, Outlook, CBuilder, Paradox, Delphi and dabadabadoo with complete brain washout!! Can any one suggest some solutions. Keep it simple, but be precise.
bcindc@msn.com DC Public Schools
 
Hi, um I'm assuming you guys use Outlook to send emails. This is how I send emails and attachments by running Outlook through code:

If (Not lstrTo = vbNullString) Then
'<start outlook application>
Set lobjOutlook = CreateObject(&quot;Outlook.application&quot;)
'<create new mail item (0)>
Set lobjMail = lobjOutlook.createitem(0)
Let lobjMail.subject = lstrSubject
Let lobjMail.HTMLBody = lstrBody '<add body>

'Let lobjMail.SentOnBehalfOfName = lstrFrom

Let lobjMail.to = lstrTo '<apply To list>

'Let objMail.cc = lstrCc '<apply CC list>
'Let lobjMail.bcc = lstrBCC '<apply bcc list>

'<add attachments>
Set lobjAttachment = lobjMail.attachments
lobjAttachment.Add path1, , , <Description of the file>
lobjAttachment.Add path2, , , <Description of the file>
lobjAttachment.Add path3, , , <Description of the file>
lobjAttachment.Add path4, , , <Description of the file>
......

'lobjMail.display

lobjMail.send
lobjOutlook.Quit

End If

NOTE: A few lines of code are commented out, (i.e: .CC, .BCC, .SentOnBehalfOfName, and .display) because they are optional. There's no need to explain .CC and .BCC. As to the other two, .SentOnBehalfOfName allows you to put a string of your choice in the email's From Field instead of your email address, or email ID(however, the outlook has to be able to recognize it); and the .display method allows you to just open the outlook application with the previously determined settings (such as email message, attachments, subject) and it allows you to edit anything you want before sending the email. (Of course to use the .display method, the .send and .quit methods should be deleted)
I hope this helps you a little bit. If it doesn't, sorry for making you read such a long message :)
Good luck! --- Merlin
 
Merlin,
Thanx a whole bunch. 160 schools are grateful to you! Some of what you said appears to be Hebrew, but I think you have solved it for me! If you ever have an advanced Paradox or ObjectPal question, mabye I can return the favor.
Bob
 
LOL, Hebrew huh? :)
Yeah, glad I could help. And I'll be sure to ask u when I run into problems. Just let me find out what they are first :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top