Results 1 to 2 of 2

Thread: Compact And Repair Database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    Post

    Hello everybody...

    How to compact and repair database Access 2000
    using DAO in VB5.

    Any Suggestion from you all...

  2. #2
    New Member
    Join Date
    Feb 2000
    Location
    Hull,Quebec, Canada
    Posts
    7

    Post

    You need to use DAO360.dll. I'm not sure if it is included in the MDAC2.1 Update. Choose 'Project > References' from the file menu and select 'Microsoft DAO 3.6 Object Librairy'. You need to create an instance of it like so:

    dim var as DBENGINE
    set var = new DBEngine

    var.Compact databasesource,databasedest


    With Version 3.5 there were 2 separate methods. 1 for compact and 1 for repair. Now with version 3.6 the compact also does a repair in the same function. With the compact method, you must select a new destination for the compacted DB, but here is a way around that, simple but effective:

    var.Compact databasesource,databasedest
    kill databasesource
    filecopy databasedest,databasesource


    You need to add the require error handling to ensure you don't kill your source database if a compacted database was not created.

    The reason you cannot use version 3.5 is because it does not support 2000 databases.




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