DoCmd.TransferDatabase

Import or export data to/from another database.

Syntax
      DoCmd.TransferDatabase(TransferType, DatabaseType, DatabaseName,
                             ObjectType, Source, Destination,
                             StructureOnly, StoreLogin)

Key
   TransferType   The type of transfer to make. AcDataTransferType 
                  default = acImport.

   DatabaseType   The type of Database to import from, export to, or link to:
                  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

   DatabaseName   The full name, including the path, of the other database.

   ObjectType     The type of object to import or export AcObjectType.

   Source         The name of the object whose data to import, export, or link.

   Destination    The name of the imported, exported, or linked object
                  in the destination database.

   StructureOnly  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.

   StoreLogin     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.
                  Use False to prevent storage of the login ID and password. 

Use TransferDatabase to import or export data between the current Access database and another database.

An alternative for Access databases is to link table(s). 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 and SELECT queries between Access and other types of databases. You can import and export any Access database object (Forms, Reports etc) if both databases are Access databases.

If you import a table from another Access database that's a linked table, the link is imported, not the table itself.

Example

'Import a report
DoCmd.TransferDatabase acImport, "Microsoft Access","C:\Demo\Demo.mdb", _
acReport, "rptBookings", "rptBookingsJuly"

“Traditionally, most of Australia's imports come from overseas” ~ Keppel Enderbery

Related:

TransferSQLDatabase - Copy an entire SQL Server database.
TransferSpreadsheet - Import or export data to/from a spreadsheet file.


© Copyright SS64.com 1999-2014
Some rights reserved