当数量超过大约 90.000 条记录时,在 VBA 中使用 RecordsAffected-method 会导致错误吗?
我正在 VBA(MS Access 内部)中运行追加查询,如下所示。 当我在 VBA 中使用 RecordsAffected 方法来跟踪已插入的记录数时,当数量超过大约 90.000 条记录及以上时,会导致错误吗? (它说某种 stackoverflow 错误)
有趣的是,当我不使用 RecordsAffected-method 时,查询工作得很好。当受影响的行数低于 90.000 时,它也可以正常工作。
有什么问题吗?这是 VBA 中的错误吗?
.
。
Dim dbs As DAO.Database
sql As String
iCount As Integer
Set dbs = CurrentDb
sql = "INSERT INTO " & ReceiveTable_selected & " SELECT " & NavisionTable_selected & ".* " & _
"FROM " & NavisionTable_selected & " " & _
"WHERE ((([" & NavisionTable_selected & "].[Entry No_] ) >" &
Counter_selected & "))"
dbs.Execute sql, dbFailOnError
iCount = dbs.RecordsAffected
I'm running an append-query in VBA (inside MS Access) that looks like the code below.
When I use the RecordsAffected-method in VBA in order to keep track of how many records that have been inserted, it causes an error when the number exceeds approximately 90.000 records and above? (some kind of stackoverflow error it says)
The funny part is, that when I don't use RecordsAffected-method, the query works just fine. And it also works fine when the number of rows affected is below 90.000.
What can be wrong? Is this a bug in VBA?
.
.
Dim dbs As DAO.Database
sql As String
iCount As Integer
Set dbs = CurrentDb
sql = "INSERT INTO " & ReceiveTable_selected & " SELECT " & NavisionTable_selected & ".* " & _
"FROM " & NavisionTable_selected & " " & _
"WHERE ((([" & NavisionTable_selected & "].[Entry No_] ) >" &
Counter_selected & "))"
dbs.Execute sql, dbFailOnError
iCount = dbs.RecordsAffected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
Dim iCount As Integer
更改为Dim iCount As Long
从帮助文件中:
和:
Change
Dim iCount As Integer
toDim iCount As Long
From the help file:
and: