microsoft access size keep growing

albertkhor

Well-known member
Joined
Jan 12, 2006
Messages
150
Programming Experience
Beginner
do anyone know this problem?
after few thousand insert, delete, update command my database size will grown even there is no data inside my database!
why this will happen and slution to solve it?
 
Hi Albert,
you need to not worry much about that as it is kind of ussual for the access. Access is particularly bad at memory leaks and If you work with large databases, chances are these are well known experiences :D

explanation and (possible) solution:
There are many things that can cause a database to grow. Each time you add an object to an Access database (.MDB) file, it gets larger. And why shouldn’t it? You are certainly using more space to define the properties and methods of the object. Reports tend to take up the most space while forms use a little less space as the number of properties associated with each form and each control on a form are fewer than reports. Table attachments (links) and queries take up very little space while VBA code grows proportionally to the number of lines in both Modules and code behind forms and reports. If you store data in your program database this also takes up space proportionally to the number of records in the table. There are many other reasons why a database grows.

I know it is a bit strange that althrough you expect that size of the file will be decreased it gets larger. But, notice that each time you make a change to any object, even a simple one, a duplicate copy of the object is created until you compact the database. Within a few hours of work, Access databases can begin to grow larger and larger. If the database contains thousands of lines of VBA code, the database can grow to two or three times its original size very quickly especially when compiled and before it is compacted.

With other words, as you add, delete and modify objects, Access doesn't always cleanup after itself. Instead, you should select the database container and select Tools -> Database Utilities -> Compact Database. This will compact the database to the same name and reopen the database running any Startup commands or Autoexec macro you may have. For the less aggressive, you may want to close the database first and compact the database to a different name effectively creating a compacted backup. You can then use the new database or delete the old and rename the new database to the original name.

Also, it can be useful for your database if you check "Compact on Close" option Tools -> Options -> General tab -> check the "Compact on Close".
Then close your database and wait for a while then reopen it.

I hope this helped you to figure out how Access database is managing objects and how it gets affect on the size.

Regards ;)
 
kulrom said:
Hi Albert,
you need to not worry much about that as it is kind of ussual for the access. Access is particularly bad at memory leaks and If you work with large databases, chances are these are well known experiences :D

explanation and (possible) solution:
There are many things that can cause a database to grow. Each time you add an object to an Access database (.MDB) file, it gets larger. And why shouldn’t it? You are certainly using more space to define the properties and methods of the object. Reports tend to take up the most space while forms use a little less space as the number of properties associated with each form and each control on a form are fewer than reports. Table attachments (links) and queries take up very little space while VBA code grows proportionally to the number of lines in both Modules and code behind forms and reports. If you store data in your program database this also takes up space proportionally to the number of records in the table. There are many other reasons why a database grows.

I know it is a bit strange that althrough you expect that size of the file will be decreased it gets larger. But, notice that each time you make a change to any object, even a simple one, a duplicate copy of the object is created until you compact the database. Within a few hours of work, Access databases can begin to grow larger and larger. If the database contains thousands of lines of VBA code, the database can grow to two or three times its original size very quickly especially when compiled and before it is compacted.

With other words, as you add, delete and modify objects, Access doesn't always cleanup after itself. Instead, you should select the database container and select Tools -> Database Utilities -> Compact Database. This will compact the database to the same name and reopen the database running any Startup commands or Autoexec macro you may have. For the less aggressive, you may want to close the database first and compact the database to a different name effectively creating a compacted backup. You can then use the new database or delete the old and rename the new database to the original name.

Also, it can be useful for your database if you check "Compact on Close" option Tools -> Options -> General tab -> check the "Compact on Close".
Then close your database and wait for a while then reopen it.

I hope this helped you to figure out how Access database is managing objects and how it gets affect on the size.

Regards ;)

Kulrom, thanks again~ But is that possible to do in coding? Can you teach me?
 
Back
Top