Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to compact a database programatically (2002 SP3)

    What I really want to do is issue the following command

    DoCmd.RunCommand acCmdCompactDatabase

    However, when I do, I get an error messager saying that I cannot from a Macro or VBA and I should "click on Tools, compact & repair"

    I presume that this is "by design" (and begs the question of why Microsoft provide acCmdCompactDatabase as an option) <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Are there any automated ways of compacting?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to compact a database programatically (2002 SP3)

    See Why CompactCurrentDatabase doesn't work from code on the Access Web. Don't be put off by the title, it points to several methods to compact a database in code.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to compact a database programatically (2002 SP3)

    Hans <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15> As always - little gems of knowledge. I like the look of the Compact on Close option <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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