Solved

VBA script for Access to outlook email

Posted on 2014-10-22
4
221 Views
Last Modified: 2016-02-10
I am using Access as a front end for an SQL express database.  I am searching for a VBA script that will allow me to send an email which will populate from three fields - two email fields (student and instructor) which I will send the email to, and one larger field which will contain a section of notes about what was discussed during an appointment  (body of email or an attachment - either works).
0
Comment
Question by:mjburgard
  • 2
4 Comments
 
LVL 12

Assisted Solution

by:James Elliott
James Elliott earned 250 total points
ID: 40396995
This will get you started with using an Outlook object in VBA.

Including information from a recordset should be fairly simple from here.

http://msdn.microsoft.com/en-us/library/office/ff197046(v=office.15).aspx
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 40397574
If you have no need of automating Outlook, then you can use SendObject:

Dim sBody as String
Dim rst As DAO.Recordset
Set rst = Currentdb.OpenRecordset("SELECT * FROM YourTable")

DoCmd.SendObject acSendNoObject, , , rst("EmailTo"), , , "Your Subject", rst("BodyField")

Or, if needed, you can automate Outlook. Here's an EE article:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_4316-Automate-Outlook-in-VBA-with-the-OutlookCreateItem-Class.html
0
 
LVL 1

Author Comment

by:mjburgard
ID: 40410780
I have glanced at both of those and will be looking at them in more depth later this week - Both of the above appear to be very helpful and what I am looking for.
0
 
LVL 1

Author Closing Comment

by:mjburgard
ID: 40619306
Thanks for the help!
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now