I read how to compact an Access database in VB6 (w/CompactDatabase()), but I can't get it to work in VB.NET. I also can't find CompactDatabase in the VB.NET help. Can someone please clue me in? Thanks!
As a general rule, you should not compact an Access database... particularly not from anything that's "net!"
An Access database file is designed to be a self-maintaining structure that manages and recycles its own space. The indexes will never be as optimal as they were when first created but they'll never be too bad either. There is no reason to squish it. Just leave it alone and it will happily run for years.
Thanks for the tip, but actually I need to be able to email it. Somehow it got up to 44MB, but compacting it reduces it to 0.5MB. I've tried importing and exporting from XML, but it gets the relationships wrong when there are master records with no detail lines. I don't know how to fix this, and I need to do something quick, so I thought I'd try compacting the database...but I can't get that to work either. Any ideas?
If the database in question is an Access 2000 database, there's an option you can set - Compact On Close (Tools | Options | General). It will compact itself once all the users are out. I set that on ALL my databases...I got sick of seeing my databases growing and getting slower because of Access and it's page allocation. I don't think that option's available in Access 97, though, and I don't have any experience with any new versions of Access, so hope that helps.