Emailing from Query or Contact List

Commander Dave

Registered User.
Local time
Today, 03:43
Joined
Dec 13, 2010
Messages
11
I have used Access in the past as a contact manager and remember being able to create a Query and email based on the contents of the Query.

I'd simply like to select all people in a particular category (field created) and then email one email (bulk) to all of them. For some reason I can't figure out how to do this in Access, and haven't found the solution on here.

Example:

First Name | Last Name | Email | Category

Jim Kelly jimbob@... Student Pilot
Orville Wright orville@.... Pilot
Wilbur Wright wilbur@.... Pilot
Grace Slick grace@..... Singer

I want to email all of the pilots in the above list. I have created a Query with a wildcard "*pilot*" which should give me any reference to pilot.

However once I have the Query displayed I can not seem to easily email the group.

I am using one of the Contacts templates provided in Access 2010.
 
The code behind your button is going to look something like;
Code:
Private Sub CmdEmail_Click()
DoCmd.SendObject acSendReport, "ReportNameHere", "FormatHere", MessageTo, MessageCC , MessageBCC , "SubjectHere", [Body], True
End Sub
You then need to concatenate all your to addresses and insert them into either MessageTo, MessageCC or MessageBCC of the above.
 
I can't simply sort my database using the query, create and send an email to those slected?
 
If you are only send one email per button click to one recipient, your code will be quite straight forward as you can simply pull all your info together in a query.

However given you have multiple recipients you will need to either concatenate all your to addresses (so you can send a single email to multiple recipients) or alternately cycle through your selected to addresses and send individual emails to each.
 
The code behind your button is going to look something like;
Code:
Private Sub CmdEmail_Click()
DoCmd.SendObject acSendReport, "ReportNameHere", "FormatHere", MessageTo, MessageCC , MessageBCC , "SubjectHere", [Body], True
End Sub
You then need to concatenate all your to addresses and insert them into either MessageTo, MessageCC or MessageBCC of the above.

I tried to utilize this type of code, but ran into errors.

I also tried to concatenate the records and ran into difficulty there. I have created three new forms, one for each type of search I plan on using. I then added an email button from another form which works well for the single email.

Problem still lies with the data, and the concatenation. If I have selected filtered data, can I access this data, or will the email fields still continue to reference from the main DB.

Second problem was the concatenation. I followed the link you sent, but without knowledge of the sample database I had a hard time making sense of it all.

I just want to send an email to the now 50-100 selected contacts with ease.
 
Last edited:
I am still trying to make this work utilizing several examples of code provided here and from other sites.

I seem to be getting closer to making this work, but still receiving errors. Here is the latest revision, and closest I have come to making it work.

I get an Error 438 - Object doesn't support this property or method.

I have been trying to use this code on one of my forms utilizing the Event Procedure. Possible error is in Red below

Private Sub Concatenate_Click()
Dim MyDB As DAO.Database
Dim rstEAddr As DAO.Recordset
Dim strBuild As String

Set MyDB = CurrentDb
Set rstEAddr = MyDB.OpenRecordset("Contacts", dbOpenForwardOnly)

With rstEAddr
Do While Not .EOF
If ![EmailAddress] <> "" Then
strBuild = strBuild & ![EmailAddress] & ";"
End If
.MoveNext
Loop
End With

rstEAddr.Close
Set rstEAddr = Nothing

Concatenate = Left$(strBuild, Len(strBuild) - 1)
End Sub
 

Users who are viewing this thread

Back
Top Bottom