Quantcast
Channel: Product Communities
Viewing all articles
Browse latest Browse all 105279

Forum Post: Re: [V8 VBA] Connection between VBA macro and Access Database

$
0
0

FYI.  In case anyone has a need to connect to an Access 2007, 2010, or later (.accdb) database, below is a connection string that may be of some help:

Sub Access2010ConnectionTest(sFileSpec As String)   ' Requires - Tools > References: Add, Microsoft ActiveX Data Objects 2.7 Library - or preferred version.   Dim cn As adodb.Connection   Set cn = New adodb.Connection   With cn       .Provider = "MSDASQL"       .ConnectionString = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & sFileSpec '& ";Uid=Admin;Pwd=;"       .Open   End With   ' Database stuff here...   ' Cleanup   cn.Close   Set cn = NothingEnd Sub


Viewing all articles
Browse latest Browse all 105279


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>