文件长度 - 紧凑 [英] File Length - Compact

查看:43
本文介绍了文件长度 - 紧凑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个MS Access 2007数据库,经常增长到2Gb以上。我想在文件长度达到1.5Gb时收到警告。到目前为止,我已经使用以下代码 - 请记住,我是一个绝对的初学者! - 但不知道放在哪里。我是把它放在一个表格,或者每种形式,或者在Start Up表单上,或者在哪里?


另外,理想情况下,我希望这个模块能够压缩数据库而不是而不仅仅是提醒我手动这样做。


到目前为止的代码是:

Hi there
I have a MS Access 2007 database which frequently grows to over 2Gb. I want to be warned when the file length gets to, say, 1.5Gb. I have got so far with the following code - please bear in mind that I am an absolute beginner!!! - but don''t know where to put this. Do I put it in a Form, or in every form, or on the Start Up form, or where?

Also, ideally, I would like this Module to also Compact the database rather than just reminding me to do so manually.

The code so far is:

展开 | 选择 | 换行 | 行号

推荐答案

以下内容可行,但我认为您需要研究为什么您的数据库不断增长太大。无论如何,2 GB并不是那么大,但是你可以压缩它并重新获得任何重要空间的事实可能意味着你使用了太多临时表并且需要一个更好的策略来处理你正在做的事情。这听起来好像你需要拆分你的数据库。


至于把它放在哪里......我会在任何过程结束时说导致你的数据库大幅增长。

The following will work,but I think you need to look into why your DB is constantly growing too large. 2 GB is not all that large by any means, but the fact that you can compact it and regain any significant space probably means your using too many temporary tables and need a better strategy for what you''re doing. It definitely sounds like you need to split your DB as well.


As for where to put it...I''d say at the end of any process that is causing your DB to grow substantially.

展开 | 选择 | Wrap | 行号


您好dsatino


非常感谢你这么快的回复。更重要的是,它起作用了。还有一件事......一旦数据库被压缩,它就会关闭(按照你的DoCmd.Quit中的指示)。我希望数据库保持开放 - 我只是省略了DoCmd.Quit线吗?


是的,我确实同意我有太多的临时表 - 这些是由使表格查询覆盖原件。但是,如果我没有使用这些MTQ,只是使用一系列查询,我会收到一条错误消息Query Too Complex,因此使用表格。


非常感谢为了你的兴趣。


Viv Denham
Hi dsatino

Thank you so much for such a speedy reply. And what''s more, it has worked. Just one more thing..... once the database has compacted, it closes (as instructed in your DoCmd.Quit). I would like the database to remain open - do I just leave out the DoCmd.Quit Line?

And yes, I do agree that I have too many temporary tables - these are caused by Make Table Queries overwriting the originals. However, if I don''s use these MTQs, and just use a series of queries, I get an error message "Query Too Complex", hence using tables.

Many thanks for your interest.

Viv Denham


你可以留出那条线,是的。但是在关闭数据库之前它不会紧凑。所以它真的取决于你是否希望它直接发生在对话框之后。


如果您要保留MTQ策略,那么我强烈建议您将临时表放在另一个数据库中。不断压缩数据库可能会导致数据库损坏和丢失。
You can leave that line out, yes. But then it won''t compact until you close the DB. So it really depends on whether you want it to happen directly after the dialogue box or not.

If you''re going to keep the MTQ strategy then I strongly suggest that you put the temporary tables in another DB. Constantly compacting your DB could cause corruption and loss of your DB in it''s entirety.


这篇关于文件长度 - 紧凑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆