Hi all.
I'm toying around with (trying to) ado connections and here's what I've got:
The error comes on the "ConnectionString=" line.
I've gone through a bunch of Reference combinations and haven't found the answer yet.
I've got:
15.0 object lib
ado ext. 6.0 for DDL and Security (probably don't need that)
ActiveX Data Obj 6.1 lib
Scripting Runtime
Script Control 1.0
16.0 obj lib (had to add this one for FileDialog to work)
Thanks!
I'm toying around with (trying to) ado connections and here's what I've got:
Code:
Public Sub OpenDB_ADO()
Dim conn As ADODB.Connection
Dim strdb As String
Stop
On Error GoTo ErrHandler
strdb = CurrentProject.Path & "\sw101.accdb"
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.ACE.OLEDB.12.0;"
.Mode = adModeReadWrite
.ConnectionString = "Data Source=" * strdb
.Open
End With
If conn.State - adStateOpen Then
MsgBox "Connection was opened."
End If
conn.Close
Set conn = Nothing
MsgBox "Connection was closed."
ErrHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub
The error comes on the "ConnectionString=" line.
I've gone through a bunch of Reference combinations and haven't found the answer yet.
I've got:
15.0 object lib
ado ext. 6.0 for DDL and Security (probably don't need that)
ActiveX Data Obj 6.1 lib
Scripting Runtime
Script Control 1.0
16.0 obj lib (had to add this one for FileDialog to work)
Thanks!