Argument | Description |
transfertype | One of the following intrinsic constants: |
acExport acImport (default) acLink | |
If you leave this argument blank, the default constant (acImport) is assumed. | |
databasetype | A string expression that's the name of one of the types of databases you can use to import, export, or link data. |
In the Macro window, you can view the database types in the list for the Database Type action argument of the TransferDatabase action. | |
databasename | 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 | One of the following intrinsic constants: |
acForm acMacro acModule acQuery acReport 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. |
Argument | Description |
source | A string expression that's the name of the object whose data you want to import, export, or link. |
destination | A string expression that's 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. |
If you leave this argument blank, the default (False) is assumed. | |
saveloginid | 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. |
DoCmd.TransferDatabase acImport, "Microsoft Access", _
"C:\DBS\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"