If you try to open a connection to an Access database via ADO, you’ll have to use a different provider, whether you’re coding for 32 or 64 bits environments. Here’s a utility function I use for that (updated 25.02.2014):
|
Public Function ADOGetAccessConnString(ByVal psDatabasePathname As String) As String Dim sConnString As String #If Win64 Then sConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & psDatabasePathname #Else If GetFileExt(psDatabasePathname) = "accdb" Then sConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & psDatabasePathname Else sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & psDatabasePathname End If #End If ADOGetAccessConnString = sConnString End Function |
Of course you have to have the correct jet engine files installed on the target… Continue reading Microsoft Access Databases ADO connection strings for 32/64 bits
Recent Comments