TransferDatabase isn't available
Hello all,
I've attempted to rectify my problem from google or other vbforum threads w/o any luck... I'm working from Excel VBA 2010.
I need to save one of my sheets as a .dbf, and know that Access still has support for this file format. I have exported the sheet I need to save into an Access Database and simply need to export that Access table as a dBaseIV.
The following code snippet is causing the problem:
"Run Time error: 2046"
The command or action 'transferDatabase" isn't available now.
The following code snippet is causing the error.
vb Code:
Dim oApp As Object
Set oApp = CreateObject("Access.Application")
Dim acExport As Variant
Dim acReport As Variant
oApp.DoCmd.TransferDatabase acExport, "dBase IV", pathToAccessDB, acReport, "tempGIS", dbfLocation
the pathToAccessDB points to the .mdb containing the table I need to export. tempGIS is said table name. dbfLocation is the .dbf file I'm attempting to export to.
Any suggestions?
Thanks much!
Re: TransferDatabase isn't available
Try This...
Code:
oApp.DoCmd.TransferDatabase acExport, "dBase IV", pathToAccessDB, acTable, "tempGIS", dbfLocation
or try this...
Code:
oApp.DoCmd.TransferDatabase TransferType:=acExport, DatabaseType:="dBase IV", _
DatabaseName:=pathToAccessDB, ObjectType:=acTable, Source:="tempGIS", Destination:=dbfLocation
If it still doesn't work then how are you working with Access? LateBinding or EarlyBinding?
Re: TransferDatabase isn't available
Quote:
Originally Posted by
koolsid
Try This...
Code:
oApp.DoCmd.TransferDatabase acExport, "dBase IV", pathToAccessDB, acTable, "tempGIS", dbfLocation
Hey Sid,
I had tried that before unsuccessfully, and just did it again it insure I wasn't mistaken and it is the same error. Although I think acTable is correct parameter.
Re: TransferDatabase isn't available
I just made some changes in my post above... see it it helps...
Re: TransferDatabase isn't available
Quote:
Originally Posted by
koolsid
Try This...
Code:
oApp.DoCmd.TransferDatabase acExport, "dBase IV", pathToAccessDB, acTable, "tempGIS", dbfLocation
or try this...
Code:
oApp.DoCmd.TransferDatabase TransferType:=acExport, DatabaseType:="dBase IV", _
DatabaseName:=pathToAccessDB, ObjectType:=acTable, Source:="tempGIS", Destination:=dbfLocation
If it still doesn't work then how are you working with Access? LateBinding or EarlyBinding?
I was using late binding but switched to early binding...
vb Code:
Set oApp = Access.Application
still getting same error with that change and named parameters.
Re: TransferDatabase isn't available
If using Early Binding then use this
Code:
Dim oApp As Access.Application
Re: TransferDatabase isn't available
Quote:
Originally Posted by
koolsid
If using Early Binding then use this
Code:
Dim oApp As Access.Application
Ah yes, changed that now...
I changed it to
vb Code:
Dim oApp As Access.Application
Set oApp = Access.Application
still getting error 2046.