增长MS Access文件大小问题 [英] Growing MS Access File Size problem
问题描述
我有一个大的MS Access应用程序,在VBA代码中有很多计算。当我运行它最终崩溃,由于过多的文件大小。有很多中间表和查询被创建并随后被删除,但Access不回收空间。我努力关闭所有中间记录集,并将所有临时对象设置为无,但没有任何帮助。我可以让我的代码运行的唯一方法是运行它的一部分,停止和修复/压缩文件,然后重新启动代码。
有没有更好的方法?
感谢
您应该能够在您的VBA代码中运行compact函数。
我有以下代码片段
Public Sub CompactDB()
/ pre>
CommandBars(Menu Bar ).Controls(Tools)。Controls(Database utilities)。Controls(Compact and repair database ...)accDoDefaultAction
End Sub
你可以把它放在你的代码中来绕过它。
注意:如果您遇到这些类型的扩展问题,您也可以考虑扩展到更大的数据库系统。
I have a large MS Access application with a lot of computations in VBA code. When I run it it eventually crashes due to excessive file size. There are a lot of intermediate tables and queries created and subsequently deleted, but Access does not reclaim the space. I have diligently closed all intermediate record sets and set all temporary objects to nothing, but nothing helps. The only way I can get my code to run is to run part of it, stop and repair/compress the file then restart the code.
Isn't there a better way?
Thanks
解决方案You should be able to run the compact function from within your VBA code.
I had the below snippet bookmarked from a long time ago when I was doing access work.
Public Sub CompactDB() CommandBars("Menu Bar").Controls("Tools").Controls("Database utilities").Controls("Compact and repair database...").accDoDefaultAction End Sub
You can put that in your code to get around it.
NOTE: you might also consider growing to a larger db system if you are having these types of scaling issues.
这篇关于增长MS Access文件大小问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!