DoCmd.TransferDatabase (Access)

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

You can use the TransferDatabase action to import or export data between the current Microsoft Access database or 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 sign-in ID and password each time they connect to the ODBC database.

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


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

Arguments

Optional arguments

The following arguments are optional

TransferType (AcDataTransferType) - The type of transfer you want to make.

Possible return values are acExport - The data is exported, acImport - The data is imported, acLink - The database is linked to the specified data source.

DatabaseType (String) - A string expression that's the name of one of the types of databases that you can use to import, export, or link data. The DatabaseType 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.

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

ObjectType (AcObjectType) - The type of object to import or export.

Here you can find possible values for AcObjectType

Source (String) - A string expression that's the name of the object whose data you want to import, export, or link.

Destination (String) - A string expression that's the name of the imported, exported, or linked object in the destination database.

StructureOnly (Boolean) - 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 (Boolean) - Use True to store the sign-in 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 sign in each time you open the table. Use False if you don't want to store the sign-in ID and password. If you leave this argument blank, the default (False) is assumed. This argument is available only in Visual Basic.