Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    4

    Talking Unanswered: Compact/Repair with JRO

    Hi,

    When i try to Compact/Repair a access 2000 db in Visual Basic code with JRO it doesn't seem to work.
    But if I do it manually in access no problems.

    Any ideas?

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    THis is the code I use to repair and compact a database in vba:

    DBEngine.RepairDatabase Infile
    DBEngine.CompactDatabase Infile, Outfile
    Kill Infile
    Name Outfile As Infile


    I don't know what jro is nor what your error is...

  3. #3
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Compact/Repair with JRO

    Originally posted by ascool
    Hi,

    When i try to Compact/Repair a access 2000 db in Visual Basic code with JRO it doesn't seem to work.
    But if I do it manually in access no problems.

    Any ideas?
    What's not working about it?

    You should have a reference to the JRO Library, a variable declared as JRO.JetEngine and the same variable instantiated with the "New" keyword. After that, you should be able to use the variable to call the compact database method of the JetEngine object.

    Gregg

  4. #4
    Join Date
    Nov 2003
    Posts
    4

    Re: Compact/Repair with JRO

    Originally posted by basicmek
    What's not working about it?

    You should have a reference to the JRO Library, a variable declared as JRO.JetEngine and the same variable instantiated with the "New" keyword. After that, you should be able to use the variable to call the compact database method of the JetEngine object.

    Gregg
    The code seems to compact the database but not repair it cause I have problems with sortorders in some tables??

  5. #5
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Compact/Repair with JRO

    Originally posted by ascool
    The code seems to compact the database but not repair it cause I have problems with sortorders in some tables??
    A book that I have, "Access 2000 Power Programming" mentions that as of Access 2000 the CompactDatabase method of both DAO and ADO combine the Compact and Repair into one function. Looking at the object browser for DAO and JRO, I don't see anything for a separtate repair.
    You might consider using DAO and see if you have better results.

    Gregg

Posting Permissions

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