By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,693 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,693 IT Pros & Developers. It's quick & easy.

Compact Access Database

P: n/a
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.

--
Thanks,
Brian P. Hammer
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello Brian,
How do I go about compacting an Access XP database
from VB code?


Check out the following link:

http://support.microsoft.com/default...b;en-us;306287

Hope this helps,
Len
Nov 20 '05 #2

P: n/a
-----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.
--
Thanks,
Brian P. Hammer

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
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.