Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending Email to Outlook from Access 2010

Posted on 2010-11-19
3
Medium Priority
?
853 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 336 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 332 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 48

Assisted Solution

by:Dale Fye
Dale Fye earned 332 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

704 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