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

How to export Email addresses from Query into Outlook?

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 5223
hjozinovic
167 100+
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
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...
3
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...
2
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...
10
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
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...
8
by: ShyGuy | last post by:
Is there a way to fill the To: box in Outlook using email addresses from a table?
1
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...
6
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,...
2
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 =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.