• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 33
  • Last Modified:

Access Runtime Error 2001 when Reference: microsoft outlook 16.0 object Library is included on Runtime Only PCs

I was experimenting with sending emails from Access. So the code I found online I needed the Reference: microsoft outlook 16.0 object Library
But when I have this reference checked off as included. The PCs that have runtime only without any office including no Outlook I get a AutoExec Error of 2001.
My main PC works fine that has Outlook and full Access 2016 .

How can I work around this and why is this throwing an error 2001?
Is it because the other PCs do NOT have Outlook software on the PCs or what?

I thank you for the help.
0
Dustin Stanley
Asked:
Dustin Stanley
  • 2
  • 2
  • 2
2 Solutions
 
John TsioumprisSoftware & Systems EngineerCommented:
If you have Outlook reference then you need Outlook...plain and simple...
If you just want to send an email via Access there are other things like CDO...
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
But when I have this reference checked off as included.
Checking that reference simply tells THAT instance on THAT machine which references are required. It has nothing to do with whether a file exists on another machine, nor does it "include" anything in your database (except the requirement that the referenced library exist).

You can switch to Late Binding, but as John said if you've referenced Outlook then the end user machine MUST have Outlook installed.

Note that CDO is not longer supported (or supplied) with new versions of Exchange. I'm not sure what the best way would be to manage email on machines without Outlook - perhaps vbSendMail would work.

http://www.freevbcode.com/ShowCode.asp?ID=109

It's old, but it's used quite a bit with Access.
0
 
Dustin StanleyEntrepreneurAuthor Commented:
Thank you for the help. Is there any way to test the machine for Outlook and then someway un reference outlook at the opening of access.

Something like:
If this machine doesn't have outlook THEN
 Reference: microsoft outlook 16.0 object Library = False
Else
 Reference: microsoft outlook 16.0 object Library = True
End If

Open in new window

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
John TsioumprisSoftware & Systems EngineerCommented:
Put this in a function

Dim blnReferenceExists as boolean
blnReferenceExists =False
For Each ref In References
 If instr(ref.Name,"outlook") then
blnReferenceExists =True
End If
return blnReferenceExists
Next
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
while you could potentially "de-reference" a reference in VBA, doing so would leave your application unstable, and unless you switch to late binding and NEVER call the code that would refer to that (now) missing reference, you'd end up with quite a bit of errors (which doesn't build confidence in your application). In general, you should either (a) require users to have Outlook, and then check for that during installation or (b) don't use Outlook at all, and deploy the items needed to engage in email.
0
 
Dustin StanleyEntrepreneurAuthor Commented:
Thank you for the info. It is what I thought but the additional info is going to be very helpful down the road of my application.
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now