I am trying to open an MS Access Database from Excel using VBA. I am new to this, but have some experience with VB. Currently I can not open this database, I think because I have a password on the database.
For example. When you open the database from my computer first you have to enter the password to access the database. I am not sure how to bypass this automatically.
Can anyone help?
Here is my code:
Dim Db As Database
Dim Qd As QueryDef
Dim Rs As Recordset
Dim Ws As Object
Dim i As Integer
Dim Path As String
Path = "my path to db"
Set Ws = Sheets("sheet4"
Ws.Activate
Range("A1"
.Activate
Selection.CurrentRegion.Select
Selection.ClearContents
Range("A1"
.Select
Dim wrkODBC As Workspace
Dim conODBC As Connection
Set wrkODBC = CreateWorkspace("ODBCWorkspace01", _
"pc", "enter", dbUseODBC)
Set conODBCConnection = pReportInfo.wrkODBC.OpenConnection("ODBCConnection01", dbDriverCompleteRequired, _ True, "ODBC;test;"
Any help would be greatly appreciated.
Thanks.
Tony
For example. When you open the database from my computer first you have to enter the password to access the database. I am not sure how to bypass this automatically.
Can anyone help?
Here is my code:
Dim Db As Database
Dim Qd As QueryDef
Dim Rs As Recordset
Dim Ws As Object
Dim i As Integer
Dim Path As String
Path = "my path to db"
Set Ws = Sheets("sheet4"
Ws.Activate
Range("A1"
Selection.CurrentRegion.Select
Selection.ClearContents
Range("A1"
Dim wrkODBC As Workspace
Dim conODBC As Connection
Set wrkODBC = CreateWorkspace("ODBCWorkspace01", _
"pc", "enter", dbUseODBC)
Set conODBCConnection = pReportInfo.wrkODBC.OpenConnection("ODBCConnection01", dbDriverCompleteRequired, _ True, "ODBC;test;"
Any help would be greatly appreciated.
Thanks.
Tony