You can use the TransferDatabase action to import or export data between the current Microsoft Access database and another database. You can also link a table to the current Microsoft 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.
The TransferDatabase action uses the following arguments.
You can import and export tables between Microsoft Access and other types of databases. You can also export Microsoft Access select queries to other types of databases, as long as these select queries don’t contain parameters. Microsoft Access exports the result set of the query in the form of a table. You can import and export any Microsoft Access database object if both databases are Microsoft Access databases.
If the database you’re accessing requires a password, a dialog box is displayed when you run the macro. Type the password in this dialog box.
The TransferDatabase action is similar to clicking the Import or Link Tables subcommand of the Get External Data command or the Save As/Export command on the File menu of the Database window. You can use these commands to select a source of data, such as Microsoft Access or a type of database, spreadsheet, or text file. If you select a database, one or more dialog boxes are displayed in which you select the type of object to import or export (for Microsoft Access databases), the name of the object, and other options, depending on the database you are importing from or exporting or linking to. The arguments for the TransferDatabase action reflect the options in these dialog boxes.
If you want to supply index information for a linked FoxPro or dBASE table, first link the FoxPro or dBASE table by clicking the Link Tables subcommand of the Get External Data command on the File menu and specify the indexes in the dialog boxes for this command. Microsoft Access stores the index information in a special information (.inf) file, located in the Access folder. You can then delete the link to the linked table. The next time you use the TransferDatabase action to link this FoxPro or dBASE table, Microsoft Access uses the index information that you’ve specified.
To run the TransferDatabase action in Visual Basic, use the TransferDatabase method of the DoCmd object.
Connect Property, CopyObject Action, OutputTo Action, Save Action, SendObject Action, TransferDatabase Method, TransferSpreadsheet Action, TransferText Action.