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.
LVL 1
Dustin StanleyEntrepreneurAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

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

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
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
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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
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 Office

From novice to tech pro — start learning today.