MSAccess "MISSING: Microsoft Outlook 15.0 Object Library"

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
darls15Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
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
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
darls15Author Commented:
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
URVASHI GOHERCommented:
if I install access run time .. Can i overcome this issue?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.