Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: Compacting external Access databases

    Hi,
    Can anyone tell me how I can compact an external Access database?

    ie what I want to do in this scenario is that data from database 1 gets archived off to database 2, but after this is done and new data is written to database 1, I want to compact database 2 from within database 1

    Regards
    John

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Compacting external Access databases

    Originally posted by Sticker
    Hi,
    Can anyone tell me how I can compact an external Access database?

    ie what I want to do in this scenario is that data from database 1 gets archived off to database 2, but after this is done and new data is written to database 1, I want to compact database 2 from within database 1

    Regards
    John
    Check out the CompactRepair method ... I'd even say do a search 'cause this question has been asked before ...

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Thanks for the reply Mike, I did a search prior to this post and embarrassingly I didn't find anything, would have helped if I had looked at the 2nd page of results!!!

    I've done the following code which seems to work OK

    Sub CompactDatabase()

    'Compact security archive database
    DBEngine.CompactDatabase "H:\RISTATS\Credit_Control\1096\Credit_control_dat abase_security_archive.mdb", "H:\RISTATS\Credit_Control\1096\compact_sec_archiv e.mdb"

    'Delete old database
    Kill "H:\RISTATS\Credit_Control\1096\test external compact.mdb"

    'Rename compacted database to old database name
    Name "H:\RISTATS\Credit_Control\1096\compact_sec_archiv e.mdb" As "H:\RISTATS\Credit_Control\1096\Credit_control_dat abase_security_archive.mdb"


    End Sub



    Regards
    John

Posting Permissions

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