Search code examples
vb.netwindowsvisual-studio-2012crystal-reports

Possible resolution for "'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine"?


I have checked all the other questions relating to this error, and none match up.

I have a Visual Studio Windows application. It reads an Excel file and processes the information. Works fine on my machine and most others, but not on the new machine (64-bit Windows 7) machine. My machine is 64-bit, but because I am the developer, I have a pretty extensive libraries to reference. Other working computers are all 32-bit I think.

Here is the coding that is giving us trouble - it was originally a Jet 4.0 error, then I installed the newer Access runtime, hoping that was the problem for the 64-bit machine -

            Dim m_sConn2 As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
           "Data Source=" & OpenFileDialog1.FileName.ToString() & ";" & _
           "Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1;"";"

        Dim conn1 As New System.Data.OleDb.OleDbConnection(m_sConn2)

        Try
            conn1.Open()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

I can't install the 64-bit version of the ACE.OLEDB because there are 32-bit applications. It kicks the "not registered on the local machine" error for that machine. If I change the target CPU to "x86" it will allow us to access that connection and open the Excel file, but then we get a Crystal Reports error that the system can't find the log4net.dll file, which is because 32-bit applications can't access that.

1) Is there a reference I can add that would allow the "any CPU" or 64-bit mode to recognize the ACE.OLEDB?

2) Can I install the 32-bit version of Crystal Reports Runtime on a 64-bit machine without causing a mess?


Solution

  • I realize I'm answering my own question, but for this catch-22 situation, I was able to uninstall the Crystal Reports .NET 64-bit runtime, install the 32-bit runtime and have my application targeted for x86, and everything seems to be playing nicely.