Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    9

    Unanswered: Compacting the database you're in from a button

    Any help aprreciated,

    in MS Access 2000


    I do NOT want to compact the database that I am currently in by running "Compact and Repair database" from the Tools menu.

    I want to compact the database that I am currently in by pushing a button.
    The button should run code that compacts the database that I am currently
    in.

    It seems that you can use the compactdatabase command in code only on other databases.

    I tried a send keys solution. this works sometimes but is dodgy.

    I recall that in the old MS Access 95 and earlier there were commands to
    run menuitems. I don't see these commands anymore in MS Access 2000 or for that matter in any versiono Access from MS Access 97 forward.

    any ideas ???

    Thanks ahead of time

    Mike

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    compacting the db you are currently in is quite a challenge.
    why not keep life simple and check the compact-on-exit option??

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jul 2004
    Posts
    9
    This is for another user.

    The compact is part of a validation procedure that must take place prior to the user running a process.


    this is for an Access refresh database that creates local copies of huge ODBC linked tables form a progress database on a UNIX box. Users from all over the company have linked tables from their databases to these local tables.

    This refresh database is run daily. As you can imagine the Access database will get huge and unweildy without compacting during this process.

    In order to keep the size down, it has been proposed to delete all local
    tables and compacting the database prior to re-running the refresh.

    The system should Not let a user run the refresh until the local tables and compact have been performed.

    A flag will be set to indicate "good to go", once local tables were deleted and compact was run.

    The powers-that-be requested that we set up ONE button and forced the user to use that button prior to the refresh. The button should:

    Set the flag
    Delete all local tables
    compact the database.

    The tables can not be deleted on close because the whole point of this database is to create the tables so that the company can link to them after the process is run.

    Therefore, Compact on close does not help, since the reason I want to compact is to clean the database after the old local tables have been deleted. These are not deleted until right before the refresh runs thereby recreating the local tables for the company.

    hope that clarfies

    Thanks again

    MIke

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    yup! that's clear.
    here you go

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Jul 2004
    Posts
    9
    excellent solution!

    thank you very much Izy

Posting Permissions

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