Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MSAccess "MISSING: Microsoft Outlook 15.0 Object Library"

Posted on 2014-08-03
5
Medium Priority
?
12,857 Views
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
darls15


'**************************************************************

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 ITAcademy@somewhere.com"
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 = "ITAcademy@somewhere.com"
    .To = strEmail
    .BCC = "joe@somewhere.com"
    .Subject = "Academy ID for " & Form__F_SendLogonDetails![Centre Name]
    .HTMLBody = strBody
    .Send
End With

Set objEmail = Nothing
Exit Sub
End Sub
0
Comment
Question by:darls15
5 Comments
 
LVL 25

Assisted Solution

by:chaau
chaau earned 800 total points
ID: 40238277
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
0
 
LVL 59

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 1200 total points
ID: 40238623
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).

Jim.
0
 
LVL 85
ID: 40238639
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
1
 

Author Closing Comment

by:darls15
ID: 40240015
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.
0
 

Expert Comment

by:URVASHI GOHER
ID: 41571903
if I install access run time .. Can i overcome this issue?
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

571 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