Table of contents
Collapse the table of content
Expand the table of content

DoCmd.TransferDatabase Method (Access)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

The TransferDatabase method carries out the TransferDatabase action in Visual Basic.


expression. TransferDatabase( ** TransferType, ** DatabaseType, ** DatabaseName, ** ObjectType, ** Source, ** Destination, ** StructureOnly, ** StoreLogin )

expression A variable that represents a DoCmd object.


NameRequired/OptionalData TypeDescription
TransferTypeOptionalAcDataTransferTypeThe type of transfer you want to make.
DatabaseTypeOptionalVariantA string expression that's the name of one of the types of databases you can use to import, export, or link data. The DatatbaseType parameter is required for exporting and link data actions but not required for importing actions. The types or databases are:
  • 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 Database

  • WSS

DatabaseNameOptionalVariantA string expression that's the full name, including the path, of the database you want to use to import, export, or link data.
ObjectTypeOptionalAcObjectTypeThe type of object to import or export.
SourceOptionalVariantA string expression that's the name of the object whose data you want to import, export, or link.
DestinationOptionalVariantA string expression that's the name of the imported, exported, or linked object in the destination database.
StructureOnlyOptionalVariantUse 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.
StoreLoginOptionalVariantUse 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.


You can use the TransferDatabase action to import or export data between the current Microsoft Access database or Microsoft Access project (.adp) and another database. For Access databases you can also link a table to the current Access database from another database. With a linked table, you have access to the table's data while the table itself remains in the other database.

You can import and export tables between Access and other types of databases. You can also export Access select queries to other types of databases. Access exports the result set of the query in the form of a table. You can import and export any Access database object if both databases are Access databases.

If you import a table from another Access database that's a linked table in that database, it will still be linked after you import it. That is, the link is imported, not the table itself.

The administrator of an ODBC database can disable the feature provided by the saveloginid argument, requiring all users to enter the login ID and password each time they connect to the ODBC database.

You can also use ActiveX Data Objects (ADO) to create a link by using the ActiveConnection property for the Recordset object.


The following example imports the NW Sales for April report from the Access database NWSales.mdb into the Corporate Sales for April report in the current database:

DoCmd.TransferDatabase acImport, "Microsoft Access", _ 
    "C:\My Documents\NWSales.mdb", acReport, "NW Sales for April", _ 
    "Corporate Sales for April"

The next example links the ODBC database table Authors to the current database:

DoCmd.TransferDatabase acLink, "ODBC Database", _ 
    "ODBC;DSN=DataSource1;UID=User2;PWD=www;LANGUAGE=us_english;" _ 
    &; "DATABASE=pubs", acTable, "Authors", "dboAuthors"

See also


DoCmd Object

© 2018 Microsoft