Compact Access Database

  • Thread starter Thread starter Brian P. Hammer
  • Start date Start date
B

Brian P. Hammer

All,

How do I go about compacting an Access XP database from VB code? I use a database for various reporting information and records are often deleted and created. The size of the database can grow large so I need to be able to compact the database from my VB app.
 
-----Original Message-----
All,

How do I go about compacting an Access XP database from
VB code? I use a database for various reporting
information and records are often deleted and created.
The size of the database can grow large so I need to be
able to compact the database from my VB app.use DAO

if CnnTex.State = adStateOpen Then CnnTex.Close
strInPut = App.Path & "\Fabrica_Tex.Mdb"
strOutPut = App.Path & "\Fabrica_Tex1.Mdb"
If optDb(0) Then
Label1 = "Compressing Database..."
Screen.MousePointer = vbHourglass
'Kill strOutPut
DBEngine.CompactDatabase strInPut, strOutPut
Screen.MousePointer = vbDefault
NewName = App.Path & "\Fabrica_Tex2.Mdb"
Name strInPut As NewName
Name strOutPut As strInPut
Kill NewName
Label1 = "Database Successfully Compressed."
end if
end if
 
Back
Top