0

I'm trying to connect to an Access database through a script that would be used at login, but keep getting the "Provider cannot be found." error. From what I've found about the error, it has something to do with trying to run this with 64 bit Office, and 32 should be fine. But we have 32 bit Office running on Windows 7 Pro x64. I also found this, but I get the same error for running it with both of the wscript.exe from System32/SysWOW64. My code to connect is as follows below, in case I just did something wrong in there. Any help would be greatly appreciated.

Dim strDBPath: strDBPath = "\\server\myDB.mdb"
Dim oDBConn: Set oDBConn = CreateObject("ADODB.Connection")
Dim strConn: strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
oDBConn.Open strConn
Community
  • 1
  • 1
  • 1
    You code looks well and works fine. Tested on Windows 7 SP1 [x64] with Office 2010 [x86]. Yes, because you have x64 system you should run your script by using "C:\Windows\SysWOW64\wscript.exe test.vbs" Also, can you make database LOCAL and try again? Copy your database, let's say to C:\Temp\ and try again. – Zam Jan 29 '14 at 15:18
  • can you also try different provided, for example: "Microsoft.ACE.OLEDB.12.0" ? – Zam Jan 29 '14 at 15:27
  • @Zam I also tried the ACE.OLEDB.12.0 and it gave me the same error (I'm guessing it isn't installed, and if that's the case, it wouldnt be installed on any of the machines this script would be running on. I may be able to create something like an SCCM package to push out that out to all machines). And I get the same error, whether or not the database is local. – DavidHamilton532 Jan 29 '14 at 18:43

1 Answers1

3

If you're running IIS on x64 server, in your Pool you need to enable 32 bits applications.

Go to your Server Manager > Roles > Web Server (IIS) > Internet Information Services > (Server) Home > Application Pools > Actions pane click on Advanced Settings, Enable 32-Bit Applications > Change to True.

ario_2025
  • 31
  • 2