473,978 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to export Email addresses from Query into Outlook?

1 New Member
I am currently in the process of making/maintaining a database for a school club. I started the database mostly from scratch and i have a pretty good familiarity with Access (been using it for almost a year), but i hit a wall in terms of something i want to do, and i have a feeling i either need to make an expression, VBA, or macro model to do what i need. I need some direction as to which is the easiest to do, and exactly how i should go about doing it.
I want to be able to create a button on the main page of my database that will open an outlook email message and put all of the email addresses from a column in one of my queries into said outlook mail's "to" form. I do not want it to automatically send the email or attach anything to the email, I just need it to simply fill out the "to" form so that it will act as an active email list.
Any advice would be appreciated, but i have to be honest that i have little experience in VBA. I am not entirely computer illiterate and will probably be able to understand/alter existing code with a little advice. I will provide a little information about my database as i am sure it might be useful for explanation:

Version of Access: Access2003
Name of master table: Membership Master Table
Name of Query based off master table: Current Members
Name of column that email addresses appear in: E-mail
Program to open the emails in: Outlook2007

I appreciate all of the help/advice.
Thank You,
Scott
Sep 10 '08 #1
1 5262
hjozinovic
167 New Member
Try this in OnClick event of your button:
Expand|Select|Wrap|Line Numbers
  1. Public rst As Recordset
  2. Public qdf As QueryDef
  3. Dim cID as Variant
  4. Dim MyString As String
  5.  
  6. cID = Me.cID           'Me.cID is presumed to be ID of your current member
  7.  
  8. Set qdf = CurrentDb.CreateQueryDef("", "SELECT E-Mail FROM [Current Members] WHERE CurrID= " & cID & ";")
  9. Set rst = qdf.OpenRecordset
  10. If rst.BOF Then
  11.     Exit Sub
  12. Else
  13. rst.MoveFirst
  14. MyString = ""
  15. Do Until rst.EOF
  16.     MyString = MyString & rst![E-Mail] & ";"
  17.     rst.MoveNext
  18. Loop
  19.  
  20.  
  21.     DoCmd.SendObject , , , Mystring
  22.  
Only the CreateQueryDef part could be a little problem, so you need to be carefull there.
Put SQL with the right WHERE part and you have it.
This is one example from my database:
Expand|Select|Wrap|Line Numbers
  1. Set qdf = CurrentDb.CreateQueryDef("", "SELECT * FROM qAiring WHERE abID = " & MovID & "AND aRunNo = " & Run & ";")
Sep 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
374
by: melsink | last post by:
I am trying find the best method to send email from my a contact access database. I would need to send group emails and save the transaction in access (is. time/date, subject of email and who the emails went to). Using MS Outlook 2003, I would like access to populate the to and cc fields in outlook. Thanks Mel
3
2585
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 forms!frmPROPERTY!address). That open form also has an email address on it for the owner, and I would...
2
2774
by: Tomdhu | last post by:
I've got a Contacts & Events database in Access 2K where contacts attend various events. At present, where I want to group e-mail all the attendees who are going to attend a particular event, I run a macro which runs a select query which strips out and exports a list of their e-mail addresses ( separated by commas) into a text file. I then copy the CSV e-mail addresses and paste them into the BCC field of Outlook. I'd love to have a...
10
24427
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
36
3095
by: Liam.M | last post by:
hey guys, I have one last problem to fix, and then my database is essentially done...I would therefore very much appreciate any assistance anyone would be able to provide me with. Currently I have set up a Query to show only records that meet a certain criteria...therefore excluding all of the records that do not meet this criteria (just for the record the criteria is any record within my database that falls within two months of its "Due...
8
4441
by: ShyGuy | last post by:
Is there a way to fill the To: box in Outlook using email addresses from a table?
1
6588
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query specifies for each record... Essentially this is a make shift Ordering Tool and I want to be able to notify the receiver of the order and its specifics. q_Order_Detail_4email consists of ,,, and Example: Hello@mail.com,956,Modem,1000,xyz123...
6
1782
by: ej20 | last post by:
I have a php page that pulls email addresses from a MSSQL database. I am trying to insert these addresses into the BCC: Outlook via a link. my query is as follows:$connect = mssql_connect(SERVER, LOGIN, PASS) or die("Couldn't connect to SQL Server on SERVER"); $database = mssql_select_db(DBNAME,$connect) or die("Couldn't open database $DBNAME"); $query = "SELECT Distinct ClcEmail FROM ClientContact WHERE Deleted = 0 AND...
2
1636
by: Wayne | last post by:
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.OpenRecordset(sql) Do Until rs.EOF If Not IsNull(rs!EmailAdd) Then
0
10175
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
11833
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11592
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
10920
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7620
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
6424
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6562
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4742
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3773
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.