Solved

Getting error while compile

Posted on 2013-01-16
3
240 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now