Solved

Sending Email to Outlook from Access 2010

Posted on 2010-11-19
3
847 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 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 48

Assisted Solution

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

621 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