473,587 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help Needed With Sending Email Addresses To Outlook

I'm using the following code to send email addresses from a query to
Outlook:

Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select EmailAdd from qryEmailMerge"
Set rs = db.OpenRecordse t(sql)
Do Until rs.EOF
If Not IsNull(rs!Email Add) Then
emailTo = emailTo & rs!EmailAdd & "; "
End If
rs.MoveNext
Loop
emailTo = Left(emailTo, Len(emailTo) - 1)
DoCmd.SendObjec t acSendNoObject, , , , , emailTo

This works well UNTIL I try to use a textbox on an unbound form to
provide "qryEmailMe rge" with one or more of its parameters. Is there
a more elegant way around this than writing the results of the query
to a temporary table and then basing "qryEmailMe rge" on that table?
Aug 27 '08 #1
2 1621
ARC
What other criteria are you trying to set with the textbox values?

"Wayne" <cq*******@volc anomail.comwrot e in message
news:d2******** *************** ***********@u33 g2000pro.google groups.com...
I'm using the following code to send email addresses from a query to
Outlook:

Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select EmailAdd from qryEmailMerge"
Set rs = db.OpenRecordse t(sql)
Do Until rs.EOF
If Not IsNull(rs!Email Add) Then
emailTo = emailTo & rs!EmailAdd & "; "
End If
rs.MoveNext
Loop
emailTo = Left(emailTo, Len(emailTo) - 1)
DoCmd.SendObjec t acSendNoObject, , , , , emailTo

This works well UNTIL I try to use a textbox on an unbound form to
provide "qryEmailMe rge" with one or more of its parameters. Is there
a more elegant way around this than writing the results of the query
to a temporary table and then basing "qryEmailMe rge" on that table?
Aug 29 '08 #2
On Aug 29, 3:16*pm, "ARC" <PCES...@PCESof t.invalidwrote:
What other criteria are you trying to set with the textbox values?

"Wayne" <cqdigi...@volc anomail.comwrot e in message

news:d2******** *************** ***********@u33 g2000pro.google groups.com...
I'm using the following code to send email addresses from a query to
Outlook:
Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select EmailAdd from qryEmailMerge"
Set rs = db.OpenRecordse t(sql)
Do Until rs.EOF
* *If Not IsNull(rs!Email Add) Then
* *emailTo = emailTo & rs!EmailAdd & "; "
* *End If
* *rs.MoveNext
Loop
emailTo = Left(emailTo, Len(emailTo) - 1)
DoCmd.SendObjec t acSendNoObject, , , , , emailTo
This works well UNTIL I try to use a textbox on an unbound form to
provide "qryEmailMe rge" with one or more of its parameters. *Is there
a more elegant way around this than writing the results of the query
to a temporary table and then basing "qryEmailMe rge" on that table?
Filtering criteria for the list of people with email addresses. eg.
Company, Location etc.
Aug 29 '08 #3

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

Similar topics

3
1788
by: NotGiven | last post by:
The code below is designed to loop through rows of a database query obtaining email addresses and send an email to each. It is modified form fomr some code I found on the net. With each while loop, it updates the SENT field of the processed row to mark it sent. I have a sleep function in there to slow the processing down to see if that...
1
7746
by: Pablo | last post by:
Hi, there, I have a table which has a field (Email) populated with Email address. I am trying to send email using MS Outlook to those addresses. Everything works fine except that a warning message will pop up for every Email address stored in the table. I found that the following code caused the warning message:...
1
4142
by: Devonish | last post by:
I am composing an email with Access VB and then sending it from within Access. Everything works correctly (the email actually goes!) but Outlook ask some irritating questions that the user is required to answer. A summary of the relevant code is: Dim mailObj as Outlook.MailItem
8
2347
by: WindAndWaves | last post by:
Hi Gurus I am trying to send a newsletter from Access. Can anyone tell me what is the simplest way to send an email from Access? I would prefer not to use outlook, because this gives me all these security warnings and besides, I would prefer not to look outlook at all, so that people with Access RT could also use my code. Is there a way...
7
3548
by: Marcin | last post by:
Hello all! A few years ago I created a form with button which let me send an email with an attachment. It was created in Access 97. Now I would like to move this application into Access 2003. But when I did it, sending email code doesn`t work. Can you be so kind and give me the code how to send email with and without attachment in vb in...
3
2564
by: scott_baird | last post by:
I have an email macro setup (maybe I should go another way, but that was the quickest at the moment...) and what I would like to do is automate the "to" addressee of the email it generates for sending. What I have is an email button that creates a report based on a property address on a form (driven by a query which has criteria such as...
3
8939
by: IGD | last post by:
I don't know if this is the right place to post this or not. If not, could someone direct me elsewhere where I would find more information on how to solve my problem? Thanks! My problem is this: I am writing an application for work. This application sends a basic html email via SMTP to a group. In this group are individual people's emails,...
4
1361
by: Ima Lozer | last post by:
I am in the process of writing an app for one of my sites that will allow guests to send e-cards to other folks. The process is fairly simple. First the sender selects a card graphic via a series of radio buttons. Then he enters his and the recipient's name and email address. Next he enters a message to the sender and clicks a button to send...
0
1545
by: brossyg | last post by:
I have some VBA code that creates an email in Access and sends it from Outlook. It is based on a query with a list of email addresses. It sends the first email to Outlook and then I have to manually click the SEND button in Outlook ... and then the second email is sent to Outlook ... and so on... The list of email addresses is getting quite...
0
7849
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...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7973
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...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
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...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
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...

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.