MSAccess "MISSING: Microsoft Outlook 15.0 Object Library"

Posted on 2014-08-03
Last Modified: 2016-04-29
Hi Experts

I have an Access 2010 database which generates a simple email messages with code I came across. Everything was working perfectly until another user opened the database in Access 2013.

I'm now getting errors and in the code window under TOOLS>>REFERENCES I'm getting a "MISSING: Microsoft Outlook 15.0 Object Library" error message.

I'm presuming this is related to the different Outlook versions but due to my lack of knowledge in this area, I really don't know how to fix it or even know if it can be.

Can anyone please advise? I have pasted the code below...

Thanks in advance


Option Compare Database

Public Sub cmdSendAcademyID_Click()
Dim strEmail, strBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

'**creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

'*create string with email address

strEmail = Form__F_SendLogonDetails![EmailAdd]

strBody = strBody & "<FONT Face=Arial Color=#000000 Size=3>"
strBody = strBody & "Dear " & Form__F_SendLogonDetails![txtFName]
strBody = strBody & "<br><br>"
strBody = strBody & "The unique " & " <b> " & "ID" & "</b>" & " for the IT Academy at " & " <b> " & Form__F_SendLogonDetails![Centre Name] & "</b>" & " is " & " <b> " & Form__F_SendLogonDetails![MemberID] & "</b>" & ". Please be aware that you will also need the " & " <b> " & "Program Key" & "</b>" & " associated with your subscription to add a new Administrator. This will be sent to your school in a separate email."
strBody = strBody & "<br><br>"
strBody = strBody & "Should you require further assistance please phone 1234 5678 or email the team at"
strBody = strBody & "<br><br>"
strBody = strBody & "Regards"
strBody = strBody & "<br><br><br><br>"
strBody = strBody & "Project Team"

'***creates and sends email
With objEmail
'Set body format to HTML
    .BodyFormat = olFormatHTML
    .SentOnBehalfOfName = ""
    .To = strEmail
    .BCC = ""
    .Subject = "Academy ID for " & Form__F_SendLogonDetails![Centre Name]
    .HTMLBody = strBody
End With

Set objEmail = Nothing
Exit Sub
End Sub
Question by:darls15
    LVL 24

    Assisted Solution

    Open your database with MS Access. Press <Alt>+<F11> keys. This will bring up VBA editor. From the menu select Tools->References. There will be a reference marked as missing, like this:
    MISSING: Microsoft Outlook 15.0 Object Library

    Open in new window

    Unselect this missing reference. Select another Microsoft Outlook xx.xx Object Library from the list. Close the reference dialog (Press OK). Save your database and try again
    LVL 56

    Accepted Solution

    Yes, that's it exactly.  The code your using relies on Outlook being installed.   It also was relying  on a specific version of Outlook.

      The Office references usually auto fix themselves, so my guess is this user has Access installed and not Outlook.  They'll need to install it if you want this code to work.

      There are different methods of sending e-mail that do not rely on Outlook if that's all your doing (sending e-mail).

      Also you can avoid reference problems by declaring objects as generic objects rather than Outlook specifically.  So instead of:

    Dim objOutlook As Outlook.Application

    you do:

    Dim objOutlook As Object

      The object type is not looked up until runtime, so you don't need a specific reference set.  You do loose intellisense though.  

      Many developers develop using early binding (like you have), then switch to late binding for distribution).

    LVL 84
    One more thing - you obviously have users who are sharing the SAME database, which is why that user's reference change affected everyone else. The suggested way to share an Access database is to "split" the database into a BackEnd (the Tables only) and a FrontEnd (everything else), then "link" the tables from the BE in the FE. Then, you make copies of the FE and distribute those to each user who needs to use the database.

    Still, you should consider using Late Binding, as JimD suggests. If you do this, remember that you have to declare your Constants as well. the constant "olMailItem" will no longer be available if you remove the reference to the Outlook library, so you'll have to declare that in code:

    Dim olMailItem As Integer
    olMailItem = 0

    Author Closing Comment

    Thank you both, this is much clearer now. I ended up declaring the objects as generic objects and everything is working as it should. I appreciate your responses.

    Expert Comment

    if I install access run time .. Can i overcome this issue?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    794 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

    17 Experts available now in Live!

    Get 1:1 Help Now