Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your parameter don't seem correct. If you skip some paraters then you must
include the parameter name usin ":=". I also thing if you are need a file name not a Path. I think you want to concatenate the path with the filename. oApp.DoCmd.TransferDatabase _ TransferType:=acExport, _ DatabaseName:="MS Access", _ dbTargetPath, _ acTable, _ tbSource, _ tbDestination expression.TransferDatabase( _ TransferType, _ DatabaseType, _ DatabaseName, _ ObjectType, _ Source, _ Destination, _ StructureOnly, _ StoreLogin) "eggpap" wrote: 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 -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() joel;297512 Wrote: Your parameter don't seem correct. If you skip some paraters then you must include the parameter name usin ":=". I also thing if you are need a file name not a Path. I think you want to concatenate the path with the filename. oApp.DoCmd.TransferDatabase _ TransferType:=acExport, _ DatabaseName:="MS Access", _ dbTargetPath, _ acTable, _ tbSource, _ tbDestination expression.TransferDatabase( _ TransferType, _ DatabaseType, _ DatabaseName, _ ObjectType, _ Source, _ Destination, _ StructureOnly, _ StoreLogin) Thanks to all, I tried this oApp.DoCmd.TransferDatabase TransferType:=acExport, DatabaseType:="MS Access", DatabaseName:=dbTargetPath, ObjectType:=acTable, Source:=tbSource, Destination:=tbDestination but I get the same error. Here attached the test wb to replicate the error +-------------------------------------------------------------------+ |Filename: proveexport.xls | |Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=104| +-------------------------------------------------------------------+ -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also note the DatabaseType should be "Microsoft Access" not "MS Access"
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "eggpap" wrote: joel;297512 Wrote: Your parameter don't seem correct. If you skip some paraters then you must include the parameter name usin ":=". I also thing if you are need a file name not a Path. I think you want to concatenate the path with the filename. oApp.DoCmd.TransferDatabase _ TransferType:=acExport, _ DatabaseName:="MS Access", _ dbTargetPath, _ acTable, _ tbSource, _ tbDestination expression.TransferDatabase( _ TransferType, _ DatabaseType, _ DatabaseName, _ ObjectType, _ Source, _ Destination, _ StructureOnly, _ StoreLogin) Thanks to all, I tried this oApp.DoCmd.TransferDatabase TransferType:=acExport, DatabaseType:="MS Access", DatabaseName:=dbTargetPath, ObjectType:=acTable, Source:=tbSource, Destination:=tbDestination but I get the same error. Here attached the test wb to replicate the error +-------------------------------------------------------------------+ |Filename: proveexport.xls | |Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=104| +-------------------------------------------------------------------+ -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You are right. Now it is OK Regards -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're welcome.
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "eggpap" wrote: You are right. Now it is OK Regards -- eggpap |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can't use named arguments in this manner. You didn't provide a value for
TransferType. Try substituting a 1 for the argument 'acExport' -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "eggpap" wrote: 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 -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave: You are wrong. If you have the Access Referernce library selected
excel will recognize this parameter. OPenCurrent Database is not producing an error so the arguments are being recognized. "Dave Patrick" wrote: You can't use named arguments in this manner. You didn't provide a value for TransferType. Try substituting a 1 for the argument 'acExport' -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "eggpap" wrote: 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 -- eggpap Excel 2003 on Vista HP System - can use VBA ------------------------------------------------------------------------ eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=83143 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The OP is using late binding so I assumed there was no reference.
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "joel" wrote: Dave: You are wrong. If you have the Access Referernce library selected excel will recognize this parameter. OPenCurrent Database is not producing an error so the arguments are being recognized. |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't think so.
This is the line that's important: Dim oApp As Access.Application (removed the first few variables) means early binding. I wouldn't use this line with that declaration, but it's not important. Set oApp = CreateObject("Access.Application") Dave Patrick wrote: The OP is using late binding so I assumed there was no reference. -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "joel" wrote: Dave: You are wrong. If you have the Access Referernce library selected excel will recognize this parameter. OPenCurrent Database is not producing an error so the arguments are being recognized. -- Dave Peterson |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, I missed that but isn't the last assignment for oApp what's important?
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Dave Peterson" wrote: I don't think so. This is the line that's important: Dim oApp As Access.Application (removed the first few variables) means early binding. I wouldn't use this line with that declaration, but it's not important. Set oApp = CreateObject("Access.Application") |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do i import excel tabs in access with Docmd | Excel Programming | |||
DoCmd.SendObject (E-mail) | Excel Programming | |||
Delete Worksheets Prior To Access DoCmd.TransferSpreadsheet | Excel Programming | |||
how to format a Docmd to pull in an Access file in Text format | Excel Programming | |||
DoCmd.OpenReport problem | Excel Programming |