Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-20-2007, 01:56 AM
chergh's Avatar
chergh chergh is offline
Registered User
 
Join Date: Jun 2004
Location: Newbury
Posts: 1,398
chergh will become famous soon enoughchergh will become famous soon enough
Transferdatabase and error 3011

Hi Folks,

I am attempting to import a table using the following vba:

DoCmd.TransferDatabase acImport, "ODBC Database", _
"ODBC;DSN=rem1;UID=guest;PWD=guest;" _
& "DATABASE=Remedy", acTable, "HPD_Help_Desk", "tbl_hd1"

When I try runing the code I get run-time error 3011

The microsoft jet database engine could not find the object 'tbl_hd1'. Make sure the object exists and that you spell its name and path name correctly.

I have no idea what is causing this error anyone able to help?
Reply With Quote
Sponsored Links
  #2  
Old 04-23-2007, 07:32 AM
JohnLee JohnLee is offline
Registered User
 
Join Date: Mar 2007
Posts: 387
JohnLee is on a distinguished road
Quote:
Originally Posted by chergh View Post
Hi Folks,

I am attempting to import a table using the following vba:

DoCmd.TransferDatabase acImport, "ODBC Database", _
"ODBC;DSN=rem1;UID=guest;PWD=guest;" _
& "DATABASE=Remedy", acTable, "HPD_Help_Desk", "tbl_hd1"

When I try runing the code I get run-time error 3011

The microsoft jet database engine could not find the object 'tbl_hd1'. Make sure the object exists and that you spell its name and path name correctly.

I have no idea what is causing this error anyone able to help?
Hi,

You don't appear to be telling it where to find the table. Your code needs to look something like this

DoCmd.TransferDatabase acImport, "Microsoft Access", "G:\Audit Trail Database.mdb", acTable, "tblEmployees", "tblEmployees", False

Create a module with an appropriate name, produce code along the lines above, attach the module to a command button or whatever method you are using and your table should import each time without any problem

FAB

John
Reply With Quote
  #3  
Old 04-25-2007, 11:40 AM
Noel Noel is offline
Registered User
 
Join Date: Apr 2007
Posts: 58
Noel is on a distinguished road
I'm trying to use the same method

and I'm getting the same error. Please post if you find the solution. I'll do the same.

Thanks.

Noel
Reply With Quote
  #4  
Old 05-16-2007, 12:46 PM
mtairhead's Avatar
mtairhead mtairhead is offline
Registered User
 
Join Date: Oct 2003
Posts: 138
mtairhead is on a distinguished road
Noel..err--- The solution's right above your first post. >.>
Reply With Quote
  #5  
Old 05-16-2007, 02:40 PM
boblarson's Avatar
boblarson boblarson is online now
Super Moderator
 
Join Date: Jan 2001
Posts: 22,002
boblarson is a name known to allboblarson is a name known to allboblarson is a name known to allboblarson is a name known to allboblarson is a name known to allboblarson is a name known to all
The VBA help file is a good source of info on how to use this (as well as many other things):

Quote:
Originally Posted by Microsoft Access VBA Help File
The TransferDatabase method carries out the TransferDatabase action in Visual Basic.

expression.TransferDatabase(TransferType, DatabaseType, DatabaseName, ObjectType, Source, Destination, StructureOnly, StoreLogin)
expression Required. An expression that returns one of the objects in the Applies To list. (DoCmd is the item listed in this list)

TransferType Optional AcDataTransferType.

AcDataTransferType can be one of these AcDataTransferType constants.
acExport
acImport default
acLink
If you leave this argument blank, the default constant (acImport) is assumed.

Note The acLink transfer type is not supported for Microsoft Access projects (.adp).


DatabaseType Optional Variant. A string expression that's the name of one of the types of databases you can use to import, export, or link data.

Types of databases:
Microsoft Access (default)
Jet 2.x
Jet 3.x
dBase III
dBase IV
dBase 5.0
Paradox 3.x
Paradox 4.x
Paradox 5.x
Paradox 7.x
ODBC Databases
WSS
In the Macro window, you can view the database types in the list for the Database Type action argument of the TransferDatabase action.



DatabaseName Optional Variant. A string expression that's the full name, including the path, of the database you want to use to import, export, or link data.

ObjectType Optional AcObjectType.

AcObjectType can be one of these AcObjectType constants.
acDataAccessPage
acDefault
acDiagram
acForm
acFunction
acMacro
acModule
acQuery
acReport
acServerView
acStoredProcedure
acTable default
This is the type of object whose data you want to import, export, or link. You can specify an object other than acTable only if you are importing or exporting data between two Microsoft Access databases. If you are exporting the results of a Microsoft Access select query to another type of database, specify acTable for this argument.

If you leave this argument blank, the default constant (acTable) is assumed.

Note The constant acDefault, which appears in the Auto List Members list for this argument, is invalid for this argument. You must choose one of the constants listed above.


Source Optional Variant. A string expression that's the name of the object whose data you want to import, export, or link.

Destination Optional Variant. A string expression that's the name of the imported, exported, or linked object in the destination database.

StructureOnly Optional Variant. Use True (–1) to import or export only the structure of a database table. Use False (0) to import or export the structure of the table and its data. If you leave this argument blank, the default (False) is assumed.

StoreLogin Optional Variant. Use True to store the login identification (ID) and password for an ODBC database in the connection string for a linked table from the database. If you do this, you don't have to log in each time you open the table. Use False if you don't want to store the login ID and password. If you leave this argument blank, the default (False) is assumed.
This argument is available only in Visual Basic.
__________________
Thanks,

Bob Larson

Free samples, tools and tutorials (including Auto Frontend Update Enabling Tool)

"Have you tried turning it off and on again?"
Reply With Quote
  #6  
Old 05-16-2007, 06:12 PM
Noel Noel is offline
Registered User
 
Join Date: Apr 2007
Posts: 58
Noel is on a distinguished road
thanks for the replies

I think I posted indicating that I got the transferdatabase method to work using the odbc argument. My problem was related to the visual fox pro odbc driver, which I subsequently resolved...the correct driver is that which is dated 12/7/1999 (don't be fooled by a driver --VFPODBC.DLL-- dated any other date...as the method will not work with anything but the 12/7/1999 version).

Thanks - Noel
Reply With Quote
  #7  
Old 05-22-2007, 08:09 AM
chergh's Avatar
chergh chergh is offline
Registered User
 
Join Date: Jun 2004
Location: Newbury
Posts: 1,398
chergh will become famous soon enoughchergh will become famous soon enough
The problem was actually to do with network issues and not anything to do with the path or it not being able to find the table, all that is supplied with the little bit that says "DSN=rem1"
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World