Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    4

    Question Unanswered: Compact Access db in VB.NET?

    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!

  2. #2
    Join Date
    Oct 2003
    Posts
    706
    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.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  3. #3
    Join Date
    Jan 2004
    Posts
    4
    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?

  4. #4
    Join Date
    Jan 2004
    Location
    Ft Collins, CO
    Posts
    22
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •