How do I run a VBScript in 32-bit mode on a 64-bit machine?

Peter picture Peter · May 10, 2010 · Viewed 124.6k times · Source

I have a text file that ends with .vbs that I have written the following in:

Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.ACE.OLEDB.12.0"
Conn.Properties("Data Source") = "C:\dummy.accdb"
Conn.Properties("Jet OLEDB:Database Password") = "pass"
Conn.Open
Conn.Close
Set Conn = Nothing
  • When I execute this on a Windows 32-bit machine it runs and ends without any notion (expected).
  • When I execute this on a Windows 64-bit machine it gets the error

    Provider cannot be found. It may not be properly installed.

But it is installed. I think the root of the problem is that the provider is a 32-bit provider, as far as I know it doesn't exist as 64-bit.

If I run the VBScript through IIS on my 64-bit machine (as a ASP file) I can select that it should run in 32-bit mode. It can then find the provider.

How can I make it find the provider on Windows 64-bit? Can I tell CScript (which executes the .vbs text file) to run in 32-bit mode somehow?

Answer

volody picture volody · May 10, 2010

follow http://support.microsoft.com/kb/896456

To start a 32-bit command prompt, follow these steps:

* Click Start, click Run, type %windir%\SysWoW64\cmd.exe, and then click OK.

Then type

cscript vbscriptfile.vbs