Ant*_*hes 1 excel ms-access vba ms-access-2007 excel-vba
似乎无法在网上找到这个答案,所以我们走了.
我有一些代码可以提取excel文件并将其数据输入到MS Access 2007中的表中.
如何验证文件是否已成功导入?
例如:
If excel did import Then
MsgBox "Import successful"
Else If Excel didnt import
MsgBox "Import Not successful"
Run Code Online (Sandbox Code Playgroud)
我目前正在使用以下代码导入excel文件:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblData", "FilePath", True, "Sheet1!"
Run Code Online (Sandbox Code Playgroud)
谢谢
看完后终于搞定了!
将此代码放在"DoCmd.TransferSpreadsheet"代码之后.
If DBEngine.Errors.Count = 0 Then
MsgBox "Imported data successfully!"
ElseIf DBEngine.Errors.Count > 0 Then
MsgBox "The file did not import!"
Exit Sub
End If
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1681 次 |
| 最近记录: |