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.
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.
Remarks
For more information on how the action and its arguments work, see the action topic.
You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.
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.
Note You can also use ActiveX Data Objects (ADO) to create a link by using the ActiveConnection property for the Recordset object.
To link to a Windows SharePoint Services list, you must specify the following syntax for the DatabaseName argument:
WSS;HDR=NO;IMEX=2;DATABASE=<HTTP Server path>;LIST=<List GUID>;VIEW=;RetrieveIds=Yes;TABLE=<List name>
where <HTTP Server path>
is the path to the Windows SharePoint Services site, <List GUID>
is the globally unique identifier of the list, and <List name>
is the friendly name of the list.
The easiest way to obtain this information is to perform the following steps:
- In the database window, create a new table that links to the Windows SharePoint Services list.
- Open the linked table in Design view.
- Click Properties on the View menu.
Example
The following example imports the NW Sales for April report from the Microsoft 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"
The following example exports the contents of the Customers table to a new list named Customer List on the "http://example/WSSSite" Windows SharePoint Services site.
DoCmd.TransferDatabase transfertype:=acExport, databasetype:="WSS", _
databasename:="http://example/WSSSite", _
objecttype:=acTable, Source:="Customers", _
Destination:="Customer List", structureonly:=False