When I run the following code a connection is made to an Access database. Ok.
However, if the database is open I get an error.
Is it possible to connect to an Access database with ADO like this AND have the database open?
If so how?
Thanks
Public objConn As New ADODB.ConnectionSub DBConnectionAccess() If CBool(objConn.State And adStateOpen) Then objConn.Close Dim strPathToDB As String 'open connection to Access database strPathToDB = "C:\MyTest\Database\test.accdb" objConn.Open "Provider = Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & strPathToDB Exit SubEnd Sub
However, Scott's advice is good.