Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Oct 2002
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SendKeys '%(TDC)' quit working (2000)

    I've used SendKeys "%(TDC)" since Access 2.0 to compact/repair a database in code. Now suddenly, it has quit working for me. I've looked in my Tools, Options to see if there's some setting that I may have disturbed, but don't see anything there.

    Any ideas?

    Thanks,

    Howard

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: SendKeys '%(TDC)' quit working (2000)

    You can do this via a command line:

    "c:Program FilesMicrosoft OfficeOfficeMSAccess.exe" "path and filename of database to be compacted" /compact

    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: SendKeys '%(TDC)' quit working (2000)

    I seem to remember that beginning with Access 2000, you cannot compact and repair the current database in code. One of the reasons is that you have to have exclusive access in order to compact it. In addition, 2000 introduced the compact on exit feature.
    Wendell

  4. #4
    Lounger
    Join Date
    Oct 2002
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SendKeys '%(TDC)' quit working (2000)

    Thanks Pat and Wendell. Wendell, you are probably right about 2000 -- there sure were lots of changes from 97. However, it would seem odd that one can't run TDC from code, but can do Tools, Database Utilities, Compact from the menu. Although I don't really like Sendkeys much, the database I was going to use it in is a utility to import several large tables from another database. The first part of my code loops through the collection of tables and deletes all of them, then I hoped to use the Sendkeys command to compact it (while it was empty), and then follow up with code to import the tables. I wanted to have everything the user needed to do contained within the database, rather than having to explain to them how to compact.

    Sometimes I long for the good 'ol days :-)

    Thanks again,

    Howard

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: SendKeys '%(TDC)' quit working (2000)

    You could do this from another database.
    1. Delete all tables in the target database.
    2. Compact the target database as per my suggestion above.

    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: SendKeys '%(TDC)' quit working (2000)

    You might want to look at some of the other threads on this subject - you can do it from code, but it needs to be done from another database. See <post#=15641>post 15641</post#>, <post#=88309>post 88309</post#> and <post#=194515>post 194515</post#>. There is also some Access 97 code to do compacting on the Access web.
    Wendell

Posting Permissions

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