D
Dennis
I have 2 protected databases in Access, and I'm manipulating the information
through Codigos VBA from Excel. But my problem resides when I use the
instruction SELECT INTO... IN '[Target Database]' because the database target
is protected even, and I don't know how to include the password.
I made the following:
Dim cnnX As New ADODB.Connection
Set cnnX = New Connection
dbName = ("C:\Data\DataBase1.mdb")
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Mode = adModeWrite
.Properties("Jet OLEDBatabase Password") = "abc"
.Open dbName
End With
'Create the recordset
Dim rs As ADODB.Recordset
Set rs = New Recordset
'Determines what records to show
Dim strSQL As String
strSQL = "SELECT myTable.* INTO myNewTable IN 'C:\Data\DataBase2.mdb'
FROM myTable "
'Retreive the records
rs.CursorLocation = adUseClient
rs.Open strSQL, cnn
'close connection
cnnX.Close
Set cnnX = Nothing
Set rs = Nothing
Please, help me soon!
through Codigos VBA from Excel. But my problem resides when I use the
instruction SELECT INTO... IN '[Target Database]' because the database target
is protected even, and I don't know how to include the password.
I made the following:
Dim cnnX As New ADODB.Connection
Set cnnX = New Connection
dbName = ("C:\Data\DataBase1.mdb")
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Mode = adModeWrite
.Properties("Jet OLEDBatabase Password") = "abc"
.Open dbName
End With
'Create the recordset
Dim rs As ADODB.Recordset
Set rs = New Recordset
'Determines what records to show
Dim strSQL As String
strSQL = "SELECT myTable.* INTO myNewTable IN 'C:\Data\DataBase2.mdb'
FROM myTable "
'Retreive the records
rs.CursorLocation = adUseClient
rs.Open strSQL, cnn
'close connection
cnnX.Close
Set cnnX = Nothing
Set rs = Nothing
Please, help me soon!