mysql 导入宏文件类型_ImportExportData 宏操作

ImportExportData 宏操作ImportExportData macro action

09/18/2015

本文内容

适用于:Access 2013、Office 2013Applies to: Access 2013, Office 2013

可以使用 ImportExportData 操作在当前 Access 数据库(.mdb 或 .accdb)或 Microsoft Access 项目 (.adp) 与其他数据库之间导入或导出数据。对于 Microsoft Access 数据库,还可以从其他数据库通过链接表与当前 Access 数据库建立关联。通过链接表,在表本身仍位于其他数据库中时可以访问该表中的数据。You can use the ImportExportData action to import or export data between the current Access database (.mdb or .accdb) or Access project (.adp) and another database. For Microsoft 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.

备注

[!注释] 如果数据库不受信任,将不允许此操作。This action will not be allowed if the database is not trusted.

设置Settings

ImportExportData 操作具有下列参数。The ImportExportData action has the following arguments.

操作参数Action argument

说明Description

迁移类型Transfer Type

要进行的迁移的类型。请在“宏生成器”窗格“操作参数”部分的“迁移类型”框中选择“导入”、“导出”或“链接”。默认值为“导入”。The type of transfer you want to make. Select Import, Export, or Link in the Transfer Type box in the Action Arguments section of the Macro Builder pane. The default is Import.

注释:Access 项目 (.adp) 不支持 链接迁移类型。NOTE: The Link transfer type is not supported for Access projects (.adp).

数据库类型Database Type

作为导入来源、导出目标或链接目标的数据库的类型。在“数据库类型”框中,可以选择“Microsoft Access”或其他众多数据库类型中的某一个。默认值为“Microsoft Access”。The type of database to import from, export to, or link to. You can select Microsoft Access or one of a number of other database types in the Database Type box. The default is Microsoft Access.

数据库名称Database Name

作为导入来源、导出目标或链接目标的数据库的名称。The name of the database to import from, export to, or link to. 包括完整路径。Include the full path. 这是必需参数。This is a required argument. 对于为每个表使用单独文件的数据库类型,例如 FoxPro、Paradox 和 dBASE,请输入包含文件的目录。For types of databases that use separate files for each table, such as FoxPro, Paradox, and dBASE, enter the directory containing the file. 请在“源”参数(用于导入或链接)或“目标”参数(用于导出)中输入文件名。Enter the file name in the Source argument (to import or link) or the Destination argument (to export). 对于 ODBC 数据库, 请键入完整的开放式数据库连接 (ODBC) 连接字符串。For ODBC databases, type the full Open Database Connectivity (ODBC) connection string.

要查看连接字符串的示例,请将外部表链接到 Access:To see an example of a connection string, link an external table to Access:

在 "获取外部数据" 对话框中, 在 "文件名" 框中输入源数据库的路径。In the Get External Data dialog box, enter the path of your source database in the File name box.

单击“通过创建链接表来链接到数据源”,然后单击“确定”。Click Link to the data source by creating a linked table, and click OK.

在“链接表”对话框中选择表,然后单击“确定”。Select a table in the Link Tables dialog box, and click OK.

在设计视图中打开新链接的表,然后在“工具”下的“设计”选项卡上单击“属性表”,查看表属性。“说明”属性设置中的文本是此表的连接字符串。Open the newly linked table in Design view and view the table properties by clicking Property Sheet on the Design tab, under Tools. The text in the Description property setting is the connection string for this table.

有关 odbc 连接字符串的详细信息, 请参阅此类 odbc 数据库的 odbc 驱动程序的帮助文件或其他文档。For more information about ODBC connection strings, see the Help file or other documentation for the ODBC driver of this type of ODBC database.

对象类型Object Type

要导入或导出的对象的类型。The type of object to import or export. 如果为“数据库类型”参数选择了“Microsoft Access”,则可以在“对象类型”框中选择“表”、“查询”、“窗体”、“报表”、“宏”、“模块”、“数据访问页”、“服务器视图”、“图表”、“存储过程”或“函数”。If you select Microsoft Access for the Database Type argument, you can select Table, Query, Form, Report, Macro, Module, Data Access Page, Server View, Diagram, Stored Procedure, or Function in the Object Type box. 默认值为“表”。The default is Table. 如果选择任何其他类型的数据库,或者在“迁移类型”框中选择“链接”,则将忽略此参数。If you select any other type of database, or if you select Link in the Transfer Type box, this argument is ignored. 如果要将选择查询导出到 Access 数据库中,请在此参数中选择“表”以导出查询的结果集,然后选择“查询”导出查询本身。If you are exporting a select query to an Access database, select Table in this argument to export the result set of the query, and select Query to export the query itself. 如果要将选择查询导出到其他类型的数据库中,则将忽略此参数并导出查询的结果集。If you are exporting a select query to another type of database, this argument is ignored and the result set of the query is exported.

SourceSource

要导入、导出或链接的表、选择查询或 Access 对象的名称。对于某些类型的数据库(例如 FoxPro、Paradox 或 dBASE)而言,这是文件名。请在文件名中包含文件扩展名(如 .dbf)。这是一个必选参数。The name of the table, select query, or Access object that you want to import, export, or link. For some types of databases, such as FoxPro, Paradox, or dBASE, this is a file name. Include the file name extension (such as .dbf) in the file name. This is a required argument.

目标Destination

目标数据库中的导入表、导出表或链接表、选择查询或 Access 对象的名称。The name of the imported, exported, or linked table, select query, or Access object in the destination database. 对于某些类型的数据库(例如 FoxPro、Paradox 或 dBASE)而言,这是文件名。For some types of databases, such as FoxPro, Paradox, or dBASE, this is a file name. 请在文件名中包含文件扩展名(如 .dbf)。Include the file name extension (such as .dbf) in the file name. 这是一个必选参数。This is a required argument. 如果在“迁移类型”参数中选择“导入”,并在“对象类型”参数中选择“表”,则 Access 将创建一个包含导入表中的数据的新表。If you select Import in the Transfer Type argument and Table in the Object Type argument, Access creates a new table containing the data in the imported table. 如果导入的表或其他对象的名称与现有名称冲突,则 Access 将向该名称中添加一个数字。If you import a table or other object, Access adds a number to the name if it conflicts with an existing name. 例如,如果导入 Employees,而 Employees 已经存在,则 Access 会将导入的表或其他对象重命名为 Employees1。For example, if you import Employees and Employees already exists, Access renames the imported table or other object Employees1. 如果导出到 Access 数据库或其他数据库,则 Access 将自动替换任何同名的现有表或其他对象。If you export to an Access database or another database, Access automatically replaces any existing table or other object that has the same name.

仅结构Structure Only

指定是否只导入或导出数据库表的结构,而不涉及其中的任何数据。请选择“是”或“否”。默认值为“否”。Specifies whether to import or export only the structure of a database table without any of its data. Select Yes or No. The default is No.

注解Remarks

可以在 Access 和其他类型数据库之间导入或导出表。还可将 Access 选择查询导出到其他类型的数据库中。Access 可以以表的形式导出查询结果集。如果两个数据库均为 Access 数据库,则在两个数据库之间可以导入或导出所有的 Access 数据库对象。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.

如果从其他 Access 数据库(.mdb 或 .accdb)中导入表,而且此表是该数据库中的链接表,则此表在被导入后将仍处于链接状态。即导入的是链接而不是表本身。If you import a table from another Access database (.mdb or .accdb) 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.

如果要访问的数据库需要密码,则当您运行宏时将显示一个对话框。请在此对话框中键入密码。If the database you're accessing requires a password, a dialog box appears when you run the macro. Type the password in this dialog box.

ImportExportData 操作类似于 "外部数据" 选项卡上的 "导入" 或 "导出" 下的命令。您可以使用这些命令选择一个数据源,例如 Access 数据库或其他类型的数据库、电子表格或文本文件。如果选择数据库,则将显示一个或多个对话框,您可以在其中根据作为导入来源、导出目标或链接目标的数据库选择要导入或导出的对象类型(针对 Access 数据库)、对象名称以及其他选项。 ImportExportData 操作的参数反映这些对话框中的选项。The ImportExportData action is similar to the commands on the External Data tab, under Import or Export. You can use these commands to select a source of data, such as an Access database or another type of database, a spreadsheet, or a text file. If you select a database, one or more dialog boxes appear in which you select the type of object to import or export (for 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 ImportExportData action reflect the options in these dialog boxes.

如果要为链接的 dBASE 表提供索引信息,请先链接该表:If you want to supply index information for a linked dBASE table, first link the table:

单击 "dBASE 文件"。Click dBASE File.

在 "获取外部数据" 对话框中的 "文件名" 框中输入 dBASE 文件的路径。In the Get External Data dialog box, enter the path for the dBASE file in the File name box.

单击 "通过创建链接表来链接到数据源",然后单击 "确定"。Click Link to the data source by creating a linked table, then click OK.

在此命令的对话框中指定索引。Access 将索引信息存储到位于 Microsoft Office 文件夹下的一个特殊信息 (.inf) 文件中。Specify the indexes in the dialog boxes for this command. Access stores the index information in a special information (.inf) file, located in the Microsoft Office folder.

然后,您可以删除指向链接表的链接。You can then delete the link to the linked table.

下次使用 ImportExportData 操作链接此 dBASE 表时,Access 将使用您指定的索引信息。The next time you use the ImportExportData action to link this dBASE table, Access uses the index information that you've specified.

备注

[!注释] 如果查询或筛选链接表,则该查询或筛选将区分大小写。If you query or filter a linked table, the query or filter is case-sensitive.

若要在 Visual Basic for Applications (VBA) 模块中运行 ImportExportData 操作,请使用 DoCmd 对象的 TransferDatabase 方法。To run the ImportExportData action in a Visual Basic for Applications (VBA) module, use the TransferDatabase method of the DoCmd object.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值