Solved

Getting error while compile

Posted on 2013-01-16
3
243 Views
Last Modified: 2013-01-17
Hi Exparts,

I have a Access DB, while I compile it giving me the following error:
"User-defined type not defined"
Compile error occured in the following line:

Dim myOlApp As Outlook.Application

I am using office 2010, I am not sure if I am missing any reference, if so which reference.

Please advise.

Thanks
0
Comment
Question by:alam747
3 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 250 total points
ID: 38785537
You need a reference to Microsoft Outlook x.0 Object Library.

x will depend on your version of Outlook, eg fot Outlook 2010 it's 14.0.
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 38785759
Or use Late Binding so you don't have to worry about the Reference:

Example:

  Dim oOutlook As Object

  Set oOutlook= CreateObject("Outlook.Application")

See these KBs for more info:

Using early binding and late binding in Automation
http://support.microsoft.com/kb/245115

Late Binding in Microsoft Access
http://www.granite.ab.ca/access/latebinding.htm

mx
0
 

Author Closing Comment

by:alam747
ID: 38790589
Thanks a lot
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

773 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