Shubham
Shubham

Reputation: 979

Access VBA: Memory control, mdb file size

What are some good practices to control the memory you block up with VBA. For example, I declare objects, open connections, open recordsets, etc, but does that memory get freed again?

When I started the project I'm working on, my Access .mdb file was only 300kb, now its 13Mb!!!! (and its only 300 lines of code) Everytime I run my code, I can see my .mdb file size grow by a few hundred kb.

So please help me out on how I should go about on maintaining my file size.

Thanks!

Upvotes: 1

Views: 581

Answers (2)

Taryn
Taryn

Reputation: 247810

You can always compact and repair your Access database. In Access 2003 this option is available under Tools > Database Utilities > Compact and Repair.

The database always increases in size when you are working with it.

One thing you can always do with VBA is make sure that you Close your connections and recordsets once you are finished using them.

Upvotes: 4

Brian Willis
Brian Willis

Reputation: 23894

In Access 2010 you can use the "Compact and Repair Database" tool (on the "Database Tools" tab) to clean up your database. This will shrink the file size as much as possible.

Upvotes: 1

Related Questions