Compacting Access Database in VB

I am using VB 2005 and the company I am programming for is using MS Access data. I have found a need to compact database, that has ballooned to 4 or five times it actual size. From Access menus this can be done with the size shrinking from 5.5 MB to 1.3 MB. However, this is not the method desired by me nor the users. I want to do this from within the Application.
I have this code but
Dim jro As jro.JetEngine
jro = New jro.JetEngine
JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:
wind2.mdb;Jet OLEDB:Database Password=test", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:abbc2.mdb;Jet OLEDB:Engine Type=4;Jet OLEDB:Database Password=test")

The second DataSource - d:abbc2.mdb is what the orginal file is copying to I want to copy over the orginal name of nwind2.mdb in the compacted state. I have tried a number of shell command to rename and delete databases. They don't work I end up with two files and the old orginal is still in same state uncompacted... and the second file is compacted by not avialble to use because of name difference. Can I copy over the file nwind2.mdb with a compacted newer nwind2.mdb..

Comments

  • : I am using VB 2005 and the company I am programming for is using MS
    : Access data. I have found a need to compact database, that has
    : ballooned to 4 or five times it actual size. From Access menus this
    : can be done with the size shrinking from 5.5 MB to 1.3 MB. However,
    : this is not the method desired by me nor the users. I want to do
    : this from within the Application.
    : I have this code but
    : Dim jro As jro.JetEngine
    : jro = New jro.JetEngine
    : JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data
    : Source=d:
    wind2.mdb;Jet OLEDB:Database Password=test",
    : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:abbc2.mdb;Jet
    : OLEDB:Engine Type=4;Jet OLEDB:Database Password=test")
    :
    : The second DataSource - d:abbc2.mdb is what the orginal file is
    : copying to I want to copy over the orginal name of nwind2.mdb in the
    : compacted state. I have tried a number of shell command to rename
    : and delete databases. They don't work I end up with two files and
    : the old orginal is still in same state uncompacted... and the second
    : file is compacted by not avialble to use because of name difference.
    : Can I copy over the file nwind2.mdb with a compacted newer
    : nwind2.mdb..
    :
    :
    Okay I solved the problem just needed to walk away from the computer for a couple of hours. I used the filecopy function and file.delete function and all it great..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion