运行DoCmd.RunSavedImportExport时出现“运行时错误'31602'”

时间:2019-08-01 20:00:36

标签: ms-access-2010

尝试创建一个单击按钮以从Oracle导入多个表。以下是该按钮的On Click事件背后的代码(目前只有一个表):

Private Sub Command0_Click()

If Not IsNull(DLookup("Name", "MSysObjects", "Name='FCR_LABOR_COST_SUMMARY1'")) Then
DoCmd.DeleteObject acTable, "FCR_LABOR_COST_SUMMARY1"
End If

DoCmd.RunSavedImportExport ("Import-FCR_LABOR_COST_SUMMARY1")

End Sub

遇到错误“运行时'31602':具有指定索引的规范不存在。请指定其他索引。'Import-FCR_LABOR_COST_SUMMARY1'。”运行“ DoCmd.RunSavedImportExport”时

源表上没有任何索引。不需要在目标表上有任何索引。好像Access试图在目标表上强制执行索引。反正有关闭它吗?我是Access和VB的新手,请提供有关如何解决此问题的建议和指导。谢谢。

1 个答案:

答案 0 :(得分:0)

要保存规范,请遵循this document

创建导入或导出规范

1. Start the import or export operation from Access.

2. The import and export wizards are available on the External Data tab. The import wizards are in the Import & Link group, and the export wizards are in the Export group.

3. Follow the instructions in the wizard. After you click OK or Finish, and if Access successfully completes the operation, the Save Import Steps or Save Export Steps page appears in the wizard.

4. On the wizard page, click Save import steps or Save export steps to save the details of the operation as a specification.

5. Access displays an additional set of controls. This figure shows the dialog box with those controls available.

6. The Save Import Steps dialog box

   In the Save as box, type a name for the specification.
   In the Description box, type a description to help you or other users identify the operation at a later time.

7. To create an Outlook task that reminds you when it is time to repeat this operation, click Create Outlook Task.

8. Click Save Import or Save Export to save the specification. Access creates and stores the specification in the current database.

9. If you clicked Create Outlook Task on either the Save Import Steps or Save Export Steps page of the wizard, an Outlook Task window appears. Fill in the details of the task and then click Save & Close.

如果在宏创建后删除为 Saved Import Export Name 参数选择的已保存的导入或导出规范,则运行宏时Access将显示以下错误消息:

  

具有指定索引的规范不存在。指定其他索引。 “规范名称”。

发件人:https://support.office.com/en-us/article/runsavedimportexport-macro-action-41c366d8-524e-4c7e-847d-c2cf7abb2049