Solved

Sending Email to Outlook from Access 2010

Posted on 2010-11-19
3
808 Views
Last Modified: 2013-11-27
I am trying to simply open an Outlook email from a button on a form.
I get this error:

Compile Error:
User-defined type not defined


   Dim CsDB As DAO.Database
   Dim rst As DAO.Recordset
   Dim appOutlook As Outlook.Application (this is the line that errors)
   Dim msg As Outlook.MailItem
   Dim strEmail As String

I am sure i have had this error before but cannot see why?

Thanks in advance
0
Comment
Question by:iainmacleod
3 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 84 total points
ID: 34173127
Try to check the DAO reference is activated in the Microsoft Visual Basic. Check for outlook as well.

Follow the below steps to do it:

1. Open the Visual Basic Program
2. Under Tools, Select Reference
3. Find DAO and check it

Sincerely,
Ed
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 83 total points
ID: 34173143
Have you set a reference to the outlook 14 object library (assuming you ar using Outlook 2010 as well)?
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 83 total points
ID: 34173360
If all you want to do is open a new email, why not use the sendobject method?

docmd.SendObject acSendNoObject,, , "someone@domain.com",,,"subject", "MessageText: exclude this if you just want to open it and write the message yourself", true

You will need to include an error handler in your code to handle the error that gets generated (2501, the SendObject action was canceled) when the user cancels the message, but this is easy enough to deal with.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

747 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

10 Experts available now in Live!

Get 1:1 Help Now