Results 1 to 5 of 5

Thread: Repair/Compact DB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    Is there a way to repair and compact an MS access 97 database via VB code?

    Thanks,
    Thai

  2. #2
    Junior Member
    Join Date
    Apr 1999
    Location
    Location Greece.
    Posts
    25

    Thumbs up

    It's Simply easy.
    To Compact a DataBase just write

    DBEngine.CompactDatabase DBName, NewDBName

    To Repair a DataBase

    DBEngine.RepairDatabase DBName

    Where DBNAME is your DataBase
    And NewDBNAME is the database after compact.

    If you place your cursor on the word CompactDatabase and then press the F1 key, you will see more info.

    I hope that helps you

  3. #3
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    Hello John. Is there a reference or a component I must install before using DBEngine? Thanx
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  4. #4
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    San Jose, Ca. - USA
    Posts
    302
    in order to run the code John_Andrikopoylos gave, you need a reference to DAO.

    Note: that version 3.6(and above) of DAO does not have a repair method. The Repair method and the Compact method have been consolidated into the Compact method alone.

    Also, if you program already has a reference to ADO then you should look into using the JRO libraries instead of DAO.

  5. #5
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    Thanks dude. I already solved this using JRO, which repairs and compacts the DB.
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

Posting Permissions

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



Click Here to Expand Forum to Full Width