KB-32674: Compacting an Access database.

Question:

Why do Access files not reduce their sizes after its records are deleted? Is there another way to make them release this space?

Solution:

This is Access’ normal behavior. When records are deleted, file size remains the same. So, it is necessary to compact the database, which can be done via Access or via scripts.

To compact it via scripts, use the following example:

Set JRO = CreateObject(“JRO.JetEngine”)
JRO.CompactDatabase “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dados.mdb”,_
“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dados1.mdb;Jet OLEDB:Engine Type=5”

This will create another MDB file (which will be compacted), so this compacted file will be recorded over the old one, and then deleted. Attached to this article is an application showing this procedure.

Obs.: The attached application was develop with E3 version 3.2 build 242.

Attachments:

CompactarAccess

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

,

Deixe seu Comentário

Seu endereço de e-mail não será publicado. Campos marcados com asterisco são obrigatórios *