|
把excel表---澄清汁.xls导入已做好的同名access表中, 为了防止出现相同纪录,我
做了一个宏组,但不知何故实现不了. 可按照此宏组的思路做成的代码却又能实现.
(相关附件如下)
代码如下:
Private Sub Command1_Click()
On Error GoTo Command1_Click_Err
DoCmd.TransferSpreadsheet acImport, 8, "澄清汁", "C:\数据源\澄清汁.xls", True, "a8:l150"
DoCmd.SetWarnings False
DoCmd.OpenQuery "生成tmp表查询", acViewNormal, acEdit
DoCmd.DeleteObject acTable, "澄清汁"
DoCmd.OpenQuery "生成澄清汁表查询", acViewNormal, acEdit
DoCmd.DeleteObject acTable, "tmp"
Command1_Click_Exit:
Exit Sub
Command1_Click_Err:
MsgBox Error$
Resume Command1_Click_Exit
End Sub
|
|