Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Docmd.Transferdatabase error


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Docmd.Transferdatabase error


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Docmd.Transferdatabase error


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Docmd.Transferdatabase error

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Docmd.Transferdatabase error

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i import excel tabs in access with Docmd dimpie Excel Programming 0 June 21st 07 06:32 PM
DoCmd.SendObject (E-mail) KAnoe Excel Programming 1 November 3rd 06 12:21 PM
Delete Worksheets Prior To Access DoCmd.TransferSpreadsheet wheatcracker Excel Programming 0 March 2nd 06 12:18 AM
how to format a Docmd to pull in an Access file in Text format Campbellj4 Excel Programming 0 November 2nd 05 04:22 PM
DoCmd.OpenReport problem onedaywhen Excel Programming 0 February 25th 04 09:52 AM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"