Avatar of trbbhm
trbbhmFlag for Afghanistan asked on

Excel VBA Error &H80004005 (-2147467259) SQLOLEDB

I have a spreadsheet with VBA code that is crashing on one of my laptops.  It crashes at the "cnASC.Open" line and gives the following error message:

"System Error &H80004005 (-2147467259) unspecified error"

Dim cnASC As ADODB.Connection

cnASC.ConnectionString = "Provider=SQLOLEDB;Data Source=SAPPHIRE;Initial Catalog=asc_br;Integrated Security=SSPI;Auto Translate=False"
cnASC.Open

Open in new window


I have a sneaking suspicion that the provider might not exist on the laptop, and I've run MDAC_TYP.EXE on the laptop to try to remedy the situation, but to no avail.

I hope someone has a solution for me.  Thanks!
Microsoft ExcelVB ScriptMicrosoft SQL Server

Avatar of undefined
Last Comment
trbbhm

8/22/2022 - Mon
Neil Russell

Do you have an ODBC Datasource configured on that machine called SAPPHIRE ?
ASKER
trbbhm

NEILSR:  No I do not, but I have another laptop that does NOT experience this error and it does not have one configured either.

The SAPPHIRE machine is just a SQL server (as I'm sure you are already aware).
ASKER CERTIFIED SOLUTION
Neil Russell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Neil Russell

Oh and your code SHOULD be..
Dim cnASC As new ADODB.Connection

cnASC.ConnectionString = "Provider=SQLOLEDB;Data Source=SAPPHIRE;Initial Catalog=asc_br;Integrated Security=SSPI;Auto Translate=False"
cnASC.Open

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
trbbhm

This was the key comment that spun the gears of thought into motion:

"account you are logged in running from has all the correct credientials?"

I did not have the specific user set up in the SQL database security settings!

Once I properly configured the user, everything worked fine.  Thank you, thank you, thank you!