Link to home
Start Free TrialLog in
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!
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

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

ASKER

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
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of trbbhm

ASKER

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!