473,378 Members | 1,507 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,378 software developers and data experts.

how to generate a mailing??

Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address, city,
email, etc

Now I want to make a button wich generates a mail-field (from Outlook) with
ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin
Feb 10 '07 #1
8 1556
Here's some code which will email individual emails to a list:

http://www.datastrat.com/Code/MultipleEmail.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"martin" <no***@nowhere.orgwrote in message
news:45***********************@news.kpnplanet.nl.. .
Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address,
city, email, etc

Now I want to make a button wich generates a mail-field (from Outlook)
with ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin

Feb 10 '07 #2
Here's some code which will print the email addresses to the debug
(immediate) window, from which you can copy and paste into your BBC field:

Function Foo()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strBCC As String
Dim i As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("Your Table or Query Name", dbOpenSnapshot)

With rst
If .RecordCount 0 Then
.MoveLast
.MoveFirst
End If
End With

For i = 1 To rst.RecordCount
If Len(rst!Email) 0 Then
strBCC = strBCC & rst!Email & ";"
End If
rst.MoveNext
Next i
strBCC = Left$(strBCC, Len(strBCC) - 1)

Debug.Print strBCC

End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
"martin" <no***@nowhere.orgwrote in message
news:45***********************@news.kpnplanet.nl.. .
Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address,
city, email, etc

Now I want to make a button wich generates a mail-field (from Outlook)
with ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin

Feb 10 '07 #3
thanx Arvin!!

"Arvin Meyer [MVP]" <a@m.comwrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
Here's some code which will email individual emails to a list:

http://www.datastrat.com/Code/MultipleEmail.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"martin" <no***@nowhere.orgwrote in message
news:45***********************@news.kpnplanet.nl.. .
>Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address,
city, email, etc

Now I want to make a button wich generates a mail-field (from Outlook)
with ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin


Feb 10 '07 #4
Arvin Meyer [MVP] wrote:
Here's some code which will print the email addresses to the debug
(immediate) window, from which you can copy and paste into your BBC field:

Function Foo()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strBCC As String
Dim i As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("Your Table or Query Name", dbOpenSnapshot)

With rst
If .RecordCount 0 Then
.MoveLast
.MoveFirst
End If
End With

For i = 1 To rst.RecordCount
If Len(rst!Email) 0 Then
strBCC = strBCC & rst!Email & ";"
End If
rst.MoveNext
Next i
strBCC = Left$(strBCC, Len(strBCC) - 1)

Debug.Print strBCC

End Function
Arvin,

I think the code you posted will bomb if the query doesn't have any
records or if the 'Email' fields are Null. Perhaps you edited your
example too quickly or considered those situations too unlikely. I
quickly adapted your posted code with the goal of changing it as little
as possible:

Function Foo()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strBCC As String
Dim i As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("Your Table or Query Name", dbOpenSnapshot)

strBCC = ""

With rst
If .RecordCount 0 Then
.MoveLast
.MoveFirst
For i = 1 To rst.RecordCount
If Len(rst!Email) 0 Then
strBCC = strBCC & rst!Email & ";"
End If
rst.MoveNext
Next i
If Len(strBCC) 0 Then
strBCC = Left$(strBCC, Len(strBCC) - 1)
End If
End If
End With

Debug.Print strBCC

End Function

I didn't test this out, but it seems to have a better chance of working
properly if those rare situations arise. I usually avoid putting the
semicolon in for the case where it's going to be taken out, but in some
situations such as For'ing through tabledef fields it's needed since
it's better not to assume that a particular field is the last one.

James A. Fortune
MP*******@FortuneJames.com
Feb 11 '07 #5
Hello Arvin,

Thank you for the suggestion,

now, I'm quite a newbe, so: What exactly should I do with such a function,
where should I paste it?
I mean: I have a button already, so how can I make the button execute the
function?

and, just o be sure: in that function you sent me the link of:
Suppose that my table with contact persons is aaa
then the part "qryContacts" should be replaced by "aaa"?

thanks a lot

kind regards,
martin
"Arvin Meyer [MVP]" <a@m.comwrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
Here's some code which will email individual emails to a list:

http://www.datastrat.com/Code/MultipleEmail.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"martin" <no***@nowhere.orgwrote in message
news:45***********************@news.kpnplanet.nl.. .
>Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address,
city, email, etc

Now I want to make a button wich generates a mail-field (from Outlook)
with ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin


Feb 11 '07 #6
"James A. Fortune" <MP*******@FortuneJames.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
I think the code you posted will bomb if the query doesn't have any
records or if the 'Email' fields are Null. Perhaps you edited your
example too quickly or considered those situations too unlikely. I
quickly adapted your posted code with the goal of changing it as little as
possible:
You're correct, I wrote it quickly and tested it with a query where there
were no nulls. In that case it would only bomb if there were no email
addresses at all (unlikely, but possible) Error handling (you notice that it
was still without any) would have handled that. Moving the End If to the end
is a better solution. Also, the semicolon, if not removed, is immaterial
with every email client that I've used. I also use a similar code
construction to build up In clauses in SQL statements where a ending comma
must be removed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Feb 11 '07 #7
On Feb 11, 9:40 am, "Arvin Meyer [MVP]" <a...@m.comwrote:
You're correct, I wrote it quickly and tested it with a query where there
were no nulls. In that case it would only bomb if there were no email
addresses at all (unlikely, but possible) Error handling (you notice that it
was still without any) would have handled that. Moving the End If to the end
is a better solution. Also, the semicolon, if not removed, is immaterial
with every email client that I've used. I also use a similar code
construction to build up In clauses in SQL statements where a ending comma
must be removed.
Fair enough Arvin. BTW, I'm trying something different with
attachments. I noticed that a variant variable can be set to, say,
Array("0") and then ReDim'ed so I'm going to try to send a variant
containing the names of all the attachments to my SendEmail subroutine
in an optional argument.

James A. Fortune
CD********@FortuneJames.com

Feb 12 '07 #8
Yes, replace qryContacts with your query name. Put the function in a
standard module and call it from your command button:

Here's some code that uses the code from a form that supplies all the
fields. Remember strTo is generally yourself or an archive email address. It
is the strBCC in the body of the code that contains the string of email
addresses:

Private Sub cmdEmail_Click()
On Error GoTo Err_Handler

If Len(Me.txtTo & vbNullString) = 0 Then
MsgBox "You can't send without your email address here"
Me.txtTo.SetFocus
Exit Sub
End If

If Len(Me.txtSubject & vbNullString) = 0 Then
MsgBox "You can't send without a subject"
Me.txtSubject.SetFocus
Exit Sub
End If

If Len(Me.txtBody & vbNullString) 0 Then
Call Email(Me.txtTo, Me.txtSubject, Me.txtBody, Me.txtPath)
Else
Call Email(Me.txtTo, Me.txtSubject, , Me.txtPath)
End If

Me.txtTo.SetFocus
Me.cmdEmail.Enabled = False

Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"martin" <no***@nowhere.orgwrote in message
news:45**********************@news.kpnplanet.nl...
Hello Arvin,

Thank you for the suggestion,

now, I'm quite a newbe, so: What exactly should I do with such a function,
where should I paste it?
I mean: I have a button already, so how can I make the button execute the
function?

and, just o be sure: in that function you sent me the link of:
Suppose that my table with contact persons is aaa
then the part "qryContacts" should be replaced by "aaa"?

thanks a lot

kind regards,
martin
"Arvin Meyer [MVP]" <a@m.comwrote in message
news:uy**************@TK2MSFTNGP04.phx.gbl...
>Here's some code which will email individual emails to a list:

http://www.datastrat.com/Code/MultipleEmail.txt
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"martin" <no***@nowhere.orgwrote in message
news:45***********************@news.kpnplanet.nl. ..
>>Hello,

suppose I have a simple adress-database, with just one table "people"
In this table are all regular contactpersons-data like name, address,
city, email, etc

Now I want to make a button wich generates a mail-field (from Outlook)
with ALL my contactpersons emailadresses in the BCC-field.

Does there excist a kind of standard procedure/function for this?
Or how could I accomplish this?

Kind regards,
martin



Feb 14 '07 #9

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

Similar topics

4
by: Thom McGrath | last post by:
I'm writing a simple mailing list program, and I would like to know what the suggested method of sending a large number of emails to a list of addresses. (sounds like spam, no?) It's perfectly...
3
by: Dave Moore | last post by:
Hi All, Is it possible to implement a mailing list using PHP?. I know I could maintain a list of emails addresses in a db and send mail to them through my website, but how can I get true mailing...
0
by: Brian van den Broek | last post by:
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the "rising tide of newbie's". (Or, more accurately, the rising tide of questions from...
6
by: Francois Suter | last post by:
To all French speakers on the list, I am pleased to announce the start of a PostgreSQL general mailing list in French. Its name is pgsql-fr-generale. I hope many of you will join it so that we...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
0
by: sameer | last post by:
Hi, Steve i been trying to use this component paypay control which is really easy and excellent but this is what i think is the limitation and i just can not be done with. My checkout page...
4
by: Andy M | last post by:
ALERT There is a person by the name of Mike Cox who's trying to turn this mailing list into a Big-8 newsgroup. Many of you know that this and most of the other postresql mailing lists are...
5
by: Hunter Hillegas | last post by:
I have a CSV file with 400,000 lines of email mailing list information that I need to migrate to a new PostgreSQL database. Each line has all the info I need except a PK (I usually use an int4...
6
by: ash | last post by:
i have a web page using frameset split into few pages. And I want to generate one page of HTML code and send it through email. My question is have to generate a HTML page using asp? Thx very much.
1
by: PerumalSamy | last post by:
HI I done a project in asp.net with VB coding and sql server 2005 as back end. Now i need to generate an auto email everyday for current date based on the date field in my database table . ...
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.