【发布时间】:2011-03-01 13:19:48
【问题描述】:
如果我将 RecordsAffected 与 CurrentDb.Execute 一起使用,它总是返回 0。如果我首先创建一个数据库对象的实例,它就可以正常工作。为什么?
像这样:
Dim Db As Database
Set Db = CurrentDb
Db.Execute "DELETE * FROM [Samples] WHERE Sample=5"
If Db.RecordsAffected = 0 Then
MsgBox "Error"
End If
代替:
CurrentDb.Execute "DELETE * FROM [Samples] WHERE Sample=5"
If CurrentDb.RecordsAffected = 0 Then
MsgBox "Error"
End If
我正在使用 Access 2007 和 Microsoft Office 12.0 Access 数据库引擎对象库。
【问题讨论】:
标签: ms-access ms-access-2007 dao