473,799 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Send Individual Emails based on Query

Hi all,

Thank you already for the amount of information that has collected in
this group, very helpful indeed. I have a question in regards to
setting up individual emails to be sent based on a query:

What I currently have is a setup which is pretty much identical to this
(on a standalone access database, not network oriented, single user):

=============== =============== =======
Dim strRecipient As String
Dim strSubject As String
Dim strMessageBody As String

strRecipient = "emailaddr...@d omain.com"
strSubject = "A New Vendor PO Has Been Entered, PO Number " &
Me![PO_Nbr]
strMessageBody = "This is to notify you that a new Vendor PO has
been entered." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "PO Number " &
Me![PO_Nbr] & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "This Email has been
generated from the Vendor Repair PO Database, Please DO NOT reply."

DoCmd.SendObjec t acSendNoObject, , , strRecipient, , , strSubject,
strMessageBody, False
=============== =============== =======

What I would like to add however is a script/macro/code which runs when
I open the database in the morning and sends out individual emails
(just like the above), however picking out the records which match a
query. I am not sure what the best way is to go around this and if it's
even possible? I thank you in advance for any help you can provide (I
would also populate a field when the email is sent, so that it doesn't
go out again the next morning. Query depends on days outstanding, i.e.
email is a reminder which is sent at various intervals)

Kind Regards,

Noel

Dec 14 '06 #1
1 2910

no*******@gmail .com wrote:
Hi all,

Thank you already for the amount of information that has collected in
this group, very helpful indeed. I have a question in regards to
setting up individual emails to be sent based on a query:

What I currently have is a setup which is pretty much identical to this
(on a standalone access database, not network oriented, single user):

=============== =============== =======
Dim strRecipient As String
Dim strSubject As String
Dim strMessageBody As String

strRecipient = "emailaddr...@d omain.com"
strSubject = "A New Vendor PO Has Been Entered, PO Number " &
Me![PO_Nbr]
strMessageBody = "This is to notify you that a new Vendor PO has
been entered." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "PO Number " &
Me![PO_Nbr] & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "This Email has been
generated from the Vendor Repair PO Database, Please DO NOT reply."

DoCmd.SendObjec t acSendNoObject, , , strRecipient, , , strSubject,
strMessageBody, False
=============== =============== =======

What I would like to add however is a script/macro/code which runs when
I open the database in the morning and sends out individual emails
(just like the above), however picking out the records which match a
query. I am not sure what the best way is to go around this and if it's
even possible? I thank you in advance for any help you can provide (I
would also populate a field when the email is sent, so that it doesn't
go out again the next morning. Query depends on days outstanding, i.e.
email is a reminder which is sent at various intervals)

Kind Regards,

Noel
Open a recordset off the query and then loop through the recordset.
then use the SendObject command inside the loop.

Something along the lines of :
'---UNTESTED AIR CODE
Sub SendAllMessages ()
dim qdf as dao.querydef
dim rst as dao.recordset

set qdf=DBEngine(0) (0).Querydefs(" YourSelectQuery ")
set rst=qdf.OpenRec ordset

do until rst.EOF
DoCmd.SendObjec t acSendNoObject, ,, rst.Fields("EMa ilAddress")
'<--Fill in the args as necessary from the recordset
rst.MoveNext
Loop

rst.Close
set rst=nothing
set qdf=nothing
End sub

Dec 15 '06 #2

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

Similar topics

4
4813
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 legit, it's just an opt-in mailing. I have a feeling that using a 'while' loop with repeated calls to mail() is not the best practice. Is there something better I should be doing?
2
2836
by: Kindler Chase | last post by:
win2k server IIS5 CDO Mail Using CDO mail, I'm looping through several email addresses and sending emails. Everything works fine, however, I'd like to set a variable based on the success or not of the email being sent, i.e., <% CDO Mail stuff...
2
3324
by: serendipity | last post by:
Hi, I'm not sure if this is possible as i've googled everywhere, but i have a select query that returns a customer record with their associated sales orders. I would like to automate a process which sends an email reminder to each customer in the database, that has outstanding orders. This email reminder should have the results of the query regarding their account. The table structure are as follows.
1
3719
by: Dean | last post by:
I am using MailMessage (CDOSYS) to send emails. I would like to turn off the SMTP service (it's on the local machine) and look at the emails in the pickup folder before they get sent out. However, since it is connecting using the port, I will get an error if I turn off the SMTP service. I need to configure it so that it writes the emails to the pickup folder. I've done quite a bit of digging, and found some references to...
0
1158
by: vijay_kerji | last post by:
Dear Friends, Is it efficient and correct way to utilize web service to query/Update the database and send emails to recipients based on the retrieved data? In other words can web service be used for processing the data instead of retrieving the information from the database...?
10
24398
by: Mike Charney | last post by:
Is there a simple way to send SMTP email from Access VBA? Mike m charney at dunlap hospital dot org
1
3995
by: Jeremy | last post by:
I have a table with user names and their balance. I am going to say there are 1000 people that need to get an email of their balance statement. I have one query that pulls the names and the corresponding balance. I have one report called BalanceReport. I need to send this report (for each different member) to their email. I would guess that I would need to loop through the member list, and also only run the query for the individual to...
0
1684
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, My company will be hosting a webcast, and I need to send out 2000 individual emails to people who signed up (for login information...). I created an smtp app that I can loop through which uses smtp and our Exchange mail server. The smtp app works fine. I tested it on 10 test emails and called Client.Send 10 times. The emails went through (I emailed myself). My question is if anyone knows if Exchange server would be bogged...
1
1514
by: whisper26 | last post by:
Hi Firstly I'm using Access 2003 for my little project. I've got a bit of a problem. Basically I've been designing a database which has a table for supplier contact details,another containing a list of all the queries we have with each supplier and a query to filter for anything that hasn't been resolved. I have worked out how to send each individual query to the assigned supplier but I now want to create a means of sending each supplier...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9543
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10237
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.