473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

email selected contacts from access

hey

just wondering if anyone could offer a bit of advice to me.i have a
database with a list of contacts on it with a checkbox beside each one.i
was wondering if it was possible to place a command button on the form so
that when you click it it opens an email to send to all those with the
ticked check box?

Thanks in anticipation

Nov 13 '05 #1
4 2146
One alternative is to use the SendObject function. You did not specify
whether you wanted to send an attachment with the email, so I assumed for
the example below that no attachment will be sent, however, you can easily
change this. The example assumes that you have a True/False field
(Checkbox) named SendEmail and an Email field with the user's email address.

Public Function SendEmail()
Dim rs As DAO.Recordset
Dim sEmailTo As String

Set rs = CurrentDb.OpenRecordset("SELECT Email FROM MyTable WHERE
SendEmail=True")

'Create a semicolon separated list of email addresses
Do Until rs.EOF
sEmailTo = sEmailTo & rs("Email") & ";"
rs.MoveNext
Loop

'Strip off the last semicolon
sEmailTo = Left(sEmailTo, Len(sEmailTo) - 1)

DoCmd.SendObject acSendNoObject, "", "", sEmailTo, , , "Declaration of
Independence", "WE hold these Truths to be self-evident...", True

Set rs = Nothing

End Function

Access Help has additional information on the parameters of the SendObject
function.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"acni" <nb***@artscouncil-ni.org> wrote in message
news:d5******************************@localhost.ta lkaboutdatabases.com...
hey

just wondering if anyone could offer a bit of advice to me.i have a
database with a list of contacts on it with a checkbox beside each one.i
was wondering if it was possible to place a command button on the form so
that when you click it it opens an email to send to all those with the
ticked check box?

Thanks in anticipation
Nov 13 '05 #2
sorry there may be attachments added.it depends on what the email will be
about.though what im hoping for is that when i click this button it will
open a window in outlook so as i can type and email to all those selected
with the selected contacts email addresses already in the to field.that
make more sense?sorry i didnt make it clear but thanks for the suggestion.

Nov 13 '05 #3
The code I gave you will allow you to send attachments. The last parameter
in the SendObject line of code (value=True) opens the email window with the
select recipients in the To field. You can type the message yourself, and
if necessary add attachments to the email before sending. If you want to
attach something from the Access database, you can change the first three
parameters of the SendObject method to specify a report, or other object to
send as an attachment to the email.

A second alternative, although a little more involved, is to use the Outlook
object model to send an email from Access. You can find an example in the
following KB article.

http://support.microsoft.com/default...b;en-us;209948

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"acni" <nb***@artscouncil-ni.org> wrote in message
news:d2******************************@localhost.ta lkaboutdatabases.com...
sorry there may be attachments added.it depends on what the email will be
about.though what im hoping for is that when i click this button it will
open a window in outlook so as i can type and email to all those selected
with the selected contacts email addresses already in the to field.that
make more sense?sorry i didnt make it clear but thanks for the suggestion.
Nov 13 '05 #4
i dont quite understand how it would do this.there is no mention of
SendObject line of code (value=True) like you said and what is the bit
bout declaration of independance?surely this is meaning that this will be
included in the email or something?

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: michiel | last post by:
Does anybody know how to create a email distrubution list in ms Access thanks
5
by: stemc © | last post by:
Hi there, In work, we often mail merge letters and post them to contacts. But more and more, we've been emailing information to people instead. So far, I've been writing a single generic...
4
by: acni | last post by:
I have the following peice of code to try and send an email to selected contacts in my form.The problem is this line: StrStore = DLookup("", "qrySelectEmail", "??????") This looks up the email...
2
by: Fred | last post by:
Is there a good code sample, in C#, showing how to send eamil with attachment, from a Windows Form like 'Send To' in Word, that will pickup Contacts in Outlook/Exchange 2000. I have searched...
1
by: Kenneth H. Young | last post by:
I have written an LDAP application that allows user to select contacts from the search result data-grid and then click on an email to button which generates a new email and populates the To: field...
2
by: Tomdhu | last post by:
I've got a Contacts & Events database in Access 2K where contacts attend various events. At present, where I want to group e-mail all the attendees who are going to attend a particular event, I...
3
by: jaytrader | last post by:
I need Access to automaically email the contacts data in TXT Format like this, First_Name: John Last_Name: Smith Address: 12345 TBD When a particular Cells data is = -1 then I need to send...
1
by: charliej2001 | last post by:
Hi all My access database has import/export capabiltiy of contact details between outlook. The database is getting big now (1000+ contacts) and so are the outlook address books that have the...
2
by: HyBry | last post by:
I am quite new to this and my VB knowledge is close to zero. I have created a for that shows info about applications and it includes a subform with all the people responsible for the application....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.