473,473 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using email address from table with sendobject

Hello everyone,

Is it possible to use an email address from a table and/or query with
the Sendobject Method.
An email address from my form works fine...what I would like is the
'To:' section be filled from a query I have.

DoCmd.SendObject acReport, stDocName, acFormatRTF, _
"email address here", , [Forms]![frmStudents]![email],,

Cheers,
-Owen Mac
Oct 21 '07 #1
2 3130
Owen,
If you build a recordset on your query, you can loop through it and build
your 'strAddress' string.
I use something like:

With rs
Do Until .EOF
If strAddress = "" Then
strAddress = !Email
Else
strAddress = strAddress & ";" & !Email
End If
.MoveNext
Loop
End With

If strAddress <"" Then SendMessage(True, strAddress, "", "", 1, "",
"", "", "")
--
Bob Darlington
Brisbane
"Owen Mac" <tr********@yahoo.com.auwrote in message
news:13*************@corp.supernews.com...
Hello everyone,

Is it possible to use an email address from a table and/or query with the
Sendobject Method.
An email address from my form works fine...what I would like is the 'To:'
section be filled from a query I have.

DoCmd.SendObject acReport, stDocName, acFormatRTF, _
"email address here", , [Forms]![frmStudents]![email],,

Cheers,
-Owen Mac

Oct 22 '07 #2

"Owen Mac" <tr********@yahoo.com.auwrote in message
news:13*************@corp.supernews.com...
Hello everyone,

Is it possible to use an email address from a table and/or query with the
Sendobject Method.
An email address from my form works fine...what I would like is the 'To:'
section be filled from a query I have.

DoCmd.SendObject acReport, stDocName, acFormatRTF, _
"email address here", , [Forms]![frmStudents]![email],,

Cheers,
-Owen Mac
You can use any field from a table with any other bit of code...

Dim rs as adodb.recordset
Set rs = new adodb.recordset

strSql = "Select * from tblStudents"
rs.open strSql, currentproject.connection, 1 , 1 <--its been a while so the
i dont recall the enums for these last to values...
do while not rs.eof
docmd.sendObject acReport, stDocName, acFormatRTF, rs!emailAddress, etc
rs.movenext
loop
rs.close
set rs = nothing
Thats off the top of my head and im a bit rusty so there could be errors
above...
You will have to set the filter of the report too
....and it could all be wrong.. :)

John

Oct 22 '07 #3

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

Similar topics

0
by: Bret Shortall | last post by:
Using the SENDOBJECT action command in a Macro works fine if you hard code in their email address. SENDOBJECT TO bret@emailaddress.com SUBJECT This is the Subject line...
2
by: Del | last post by:
I have two question on sending email messages from MS Access (Versio 2000, 2002, and 2003). I have a form with a command button to send an email message, the code behide the button is as follows;...
3
by: bill mahoney | last post by:
Hello, I am using access 2000 and I am trying to email a csv file. I have only used the docmd.sendobject command but you can only email objects that are within the access database ( as far as I...
5
by: Mark | last post by:
Hi All, Is there a way to (whilst using the sendobject command) use a query as the source of email addresses. I ask this because the list is constanly changing and I don't want to keep going into...
2
by: Marcus | last post by:
Is there a way to have Access 2002 open a particular email client, when using DoCmd.SendObject? So far, Access simply opens the default email client that is set under Control Panel/Internet...
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...
17
by: DP | last post by:
hi, is there a way to send an e-mail to a customer, using ms access?? or some kind of automated mail merge, so the user only has to review the body, and click send? ive got a customer table,...
8
by: DP | last post by:
hi, i've got a piece of code, which sends an e mail to a customer, asking them to return a rened film. however, it only works if u have ms outlook express installed. is there any way of...
2
by: John Taylor | last post by:
I have created a command button on a form that prints a filtered report and e-mails the report to three people when "clicked". The three email addresses are selected on the form by three combo...
0
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,...
0
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...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.