|
各位大侠,想实现在从excel 导入到 access 时,发现要导入的目标文件不存在时,把运行时错误“3011”替换为自己设置错误提示,比如“目标文件不存在!”,按照网上搜索的设置后,几次修改都没有成功!还请各路大侠帮忙解惑!万分感谢!我用的,导入语句是:DoCmd.TransferSpreadsheet acImport, , "ABC", filepath & "123", True
网上源码:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 3022
Response = acDataErrDisplay
MsgBox "无法保存,您的输入由重复值,请仔细核对!"
Case 2169
Response = acDataErrContinue
MsgBox "可能是因为您的修改违反了设定的规则(比如不允许重复输入、不允许空着不输等)而无法保存当前的记录。"
Case 3314
Response = acDataErrContinue
MsgBox "无法保存。有些字段必须要填写,您忘记填写了,请核对"
Case Else
Response = acDataErrDisplay
Debug.Print DataErr
End select
End sub
|
|