Results 1 to 5 of 5
  1. #1
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65

    Create a button that runs "Compact and Repair Database"

    The basic rule is:

    "You cannot compact the open database by running a macro or Visual Basic code.
    Instead of using a macro or code, dick the File tab and then dick Compact and Repair Database."

    I found by searching by the title above:

    "This is truth, but this is not whole truth ;-) Following VBA code compacts
    current database:

    CommandBars.FindControl(id:=2071).accDoDefaultActi on

    Krzysztof Pozorek [MVP], Dec 20, 2007"



    My problem is how to implement this. I tried using a button to execute this code but it is of course the code was within Visual Basic and I got the basic rule message.

    Any idea how he accomplished it or was that only working in 2007?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Fairly common topic. Search forum. Here is one https://www.accessforums.net/access/...sue-53698.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65
    Thank you, so split or at the end or not at all. My purpose is to get these simple databases running smoothly. I've seen DBs that do not allow the user to see the ribbon. I would like to do that and have a convenient way for someone to C&R. Currently I have a small note at the bottom of what I call the main menu, which is the opening screen, which reads Note occasionally go to "Database Tools" [In the Ribbon] and click on "Compact and Repair Database".

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Somewhere in the links June7 gave you I suspect that there will be a caveat, it being that you can only do a C & R, on a multi-user database, if no other users are working on it.

    Additionally, before doing a C & R you should always make a backup copy of the file, as compacting, itself, is a recognized cause of corruption and data loss!

    And I simply have to ask...why do you feel the need to give end users the ability to do this?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-01-2014, 12:11 PM
  2. Replies: 1
    Last Post: 01-16-2014, 12:33 PM
  3. Replies: 0
    Last Post: 01-11-2012, 12:34 PM
  4. Compact and Repair Database "Bombs"
    By GraeagleBill in forum Access
    Replies: 16
    Last Post: 09-27-2011, 09:23 AM
  5. Create "reset filter" button
    By vanlanjl in forum Access
    Replies: 0
    Last Post: 03-03-2009, 07:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums