CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 1999
    Posts
    35

    Database Keep Growing!!

    I have a problem with my access database.. it keep growing bigger & bigger althought i delete all the record in it.. is it common ? how can i overcome this problem? do i need to refresh my database? how is can that be done? i'm using vb6.0 sp3.. please help as i have a 10 mb database with no record in it..


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Database Keep Growing!!

    apply the CompactDatabase method to your database.
    It's a method of the workspace object in DAO.


  3. #3
    Guest

    Re: Database Keep Growing!!

    how's that?


  4. #4
    Join Date
    Aug 1999
    Posts
    10

    Re: Database Keep Growing!!

    You can do two things:

    1. Use the Tools -> Database Utilities -> Compact Database
    2. (better) Start up Access with the "/Decompile" option set. This will remove
    stray code snippets effectively.

    The reason of MS Access' growth, is that it uses its own file as temprary storage, for which (1) helps to remove. You must do this from time to time, as
    this just keeps growing bigger and bigger. Another space-quirk, is stray code. For example, if you've written a lot of code in a form, and you rename that form, the code will be "lost", but not deleted, in which case (2) helps.

    NOTE: Always remember to create a backup of your access files before attempting to compact / decompile. I've never had any problems with doing so, but it's always better to be safe than sorry...

    P.Dias
    Oslo, Norway


  5. #5
    Join Date
    Feb 2000
    Location
    NY, USA
    Posts
    1

    Re: Database Keep Growing!!

    Unfortunately, as you probably know by now, compactdatabase doesn't do in VB what it does in Access. The files are simply marked as deleted and left there.

    What about this? I am experimenting with the same problem myself: I am trying this. Do you think this does it? SORT of looks that way.

    I am told that the VB5 COMPACTDATABASE function will not actually reduce a database size and that deleted records in a table are still there even though deleted AND compacted.

    I am writing a "reminder" program that will need pruning from time to time. I have a field called "permanent" (clever huh?) that has a Y or N in it. From time to time one should look at the full table and delete (mark with N) any past reminders. e.g. any January reminders. Does anyone have any comments on the following. I am not sure it works, but it seems to.

    I use the dbexecute command to do the following:

    vbcode

    Dim dbs As Database
    Dim qdf As QueryDef
    Dim whatdir as string

    ' Modify this line to include the path to Reminder
    ' on your computer.
    whatdir = app.path
    Set dbs = OpenDatabase(whatdir & "\Reminder.mdb")

    ' Select all records in the Reminder table
    ' and copy them into a new table, Emp Backup.
    dbs.Execute "Step1DelFrsh"
    ' clears out all records in Freshtemp table
    dbs.Execute "Step2AppFrsh"
    ' appends all records with a Y in the "permanent" field to Freshtemp table

    dbs.Execute "Step3DelRem"
    ' clears out all records in the Reminder table

    dbs.Execute "Step4AppRem"
    ' appends from FreshTemp table for Y in "permanent" field to Reminder table

    dbs.Execute "Step1DelFrsh"
    ' clear out Freshtemp again .. just to be sure

    dbs.Close
    ' close any open database .. just to be sure
    Beep
    /vbcode

    Sorry for the lateness of this reply. I just found this when I was looking for a solution.


  6. #6
    Join Date
    Feb 2000
    Location
    Pa
    Posts
    3

    Re: Database Keep Growing!!

    access creates "ghost space" which can only be removed by compacting the database. This can be minimized by not using make table queries. One thing to keep in mind is that the db must be closed to compact it.


  7. #7
    Guest

    Re: Database Keep Growing!!

    Pardon my ignorance. But how will I know if i'm using ADO or DAO? What are the similarities/differences?


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

Featured