E
eggpap
Hello,
In a workbook I need to import tables from one mdb password protected
database to another mdb unprotected database. I though to use the
following subroutine:
Sub Export(dbname As String, tbSource As String, tbDestination As
String)
Dim dbSourcePath As String, dbTargetPath As String, oApp As
Access.Application
On Error GoTo err_hnd
'Path dbname
Application.AutomationSecurity = msoAutomationSecurityLow
dbSourcePath = ThisWorkbook.Path & "\" & dbname
dbTargetPath = ThisWorkbook.Path & "\" & "ImportExport.mdb"
'Apre Access
Set oApp = CreateObject("Access.Application")
oApp.Visible = False
'Apre nomedb
oApp.OpenCurrentDatabase dbSourcePath, , PWORD
oApp.DoCmd.TransferDatabase acExport, "MS Access", dbTargetPath,
acTable, tbSource, tbDestination
oApp.Quit
Set oApp = Nothing
Exit Sub
err_hnd:
MsgBox Err.Description & "/" & Err.Number & " Sub Export"
Resume Next
End Sub
However I get the 2507 error on the docmd.transferdatabase statement
that says "MS Access database type not installed or task not allowed"
Any tip?
Thanks
In a workbook I need to import tables from one mdb password protected
database to another mdb unprotected database. I though to use the
following subroutine:
Sub Export(dbname As String, tbSource As String, tbDestination As
String)
Dim dbSourcePath As String, dbTargetPath As String, oApp As
Access.Application
On Error GoTo err_hnd
'Path dbname
Application.AutomationSecurity = msoAutomationSecurityLow
dbSourcePath = ThisWorkbook.Path & "\" & dbname
dbTargetPath = ThisWorkbook.Path & "\" & "ImportExport.mdb"
'Apre Access
Set oApp = CreateObject("Access.Application")
oApp.Visible = False
'Apre nomedb
oApp.OpenCurrentDatabase dbSourcePath, , PWORD
oApp.DoCmd.TransferDatabase acExport, "MS Access", dbTargetPath,
acTable, tbSource, tbDestination
oApp.Quit
Set oApp = Nothing
Exit Sub
err_hnd:
MsgBox Err.Description & "/" & Err.Number & " Sub Export"
Resume Next
End Sub
However I get the 2507 error on the docmd.transferdatabase statement
that says "MS Access database type not installed or task not allowed"
Any tip?
Thanks