473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Compacting Access database programatically

Hi all,

I'm writing a program that does a lot of table droping and updating..
After i've performed these steps it would be nice to run the compact and
repair function on the database. How can I do this?

Yours,

Simon.

Nov 15 '05 #1
2 1650
Simon,

I don't believe that there is a command that you can issue through the
OleDb provider that will do this. You might have luck with ADOX (accessed
through COM interop), but I am not sure if there is a method there to do
that.

At the worst, you can use COM interop to open up an instance of Access
(hidden of course) which opens the MDB file, and then compacts it. The
object model for Access most definitely exposes this functionality.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Simon Johnson" <ck***@hotmail.com> wrote in message
news:bt**********@sparta.btinternet.com...
Hi all,

I'm writing a program that does a lot of table droping and updating..
After i've performed these steps it would be nice to run the compact and
repair function on the database. How can I do this?

Yours,

Simon.

Nov 15 '05 #2
Hi,

In addition to what Nicholas has said about compacting
the access database, take a look at the following article.

http://support.microsoft.com/default.aspx?
scid=http://support.microsoft.com:80/support/kb/articles/Q
230/5/01.ASP&NoWebContent=1

As Nicholoas as said, u have to use COM interop to do the
above.

Hope this helps...

Regards,
Madhu

MVP | MCSD.NET
-----Original Message-----
Simon,

I don't believe that there is a command that you can issue through theOleDb provider that will do this. You might have luck with ADOX (accessedthrough COM interop), but I am not sure if there is a method there to dothat.

At the worst, you can use COM interop to open up an instance of Access(hidden of course) which opens the MDB file, and then compacts it. Theobject model for Access most definitely exposes this functionality.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Simon Johnson" <ck***@hotmail.com> wrote in message
news:bt**********@sparta.btinternet.com...
Hi all,

I'm writing a program that does a lot of table droping and updating.. After i've performed these steps it would be nice to run the compact and repair function on the database. How can I do this?

Yours,

Simon.

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peter Verhelst | last post by:
Hello, Currently I am running an Access database on a windows WTS server, running Microsoft Windows 2000 server 5.00.2195 Service Pack 3. This database should be accessible for everybody in our...
1
by: Annette Massie | last post by:
I have an Access 2000 database we originally had on a server in our network and used asp to connect to it, browse and display records. I have queries that run at 3:00 am in the morning to delete...
5
by: lappy | last post by:
Hello, I have written a small programme to compact an access 97 database. Dim je As New JRO.JetEngine ' Compacts database Data.Mdb to Data2.mdb. je.CompactDatabase...
2
by: JohnR | last post by:
When creating an msAccess db within the Access UI itself the fields that are text are NOT padded with blanks. For example, if I have a 10 char field and put in "HI" and then when I come back to...
1
by: Lyle Fairfield | last post by:
Today I asked Access 2007 to compact db1.mdb. Access 2007 showed a message to me that I did not read carefully; my recollection is that it said it could not save the compacted copy as db1.mdb,...
7
by: DavidB | last post by:
I have a standard FE/BE database. I'd like to be able to have a button on each db that allows the admin to compact the database. I am using the following code to perform the compact. Private...
1
by: Slez via AccessMonster.com | last post by:
I do a routine compact and repair on a back end MS Access 2002 database. This time I had something peculiar occur. The compact started as normal, than the following error message popped up (I...
3
by: DSSMaster | last post by:
I am trying to use windows scheduler to compact a database. In the task run line I have the following: "C:\Program Files\Microsoft Office\OFFICE11 MSACCESS.EXE" _ "C:\Files\Access\Sacroc.mdb"...
32
by: Andy | last post by:
To further follow up on my last post regarding the docmd.quit vs. Application.quit using access 2007, I noticed that docmd.quit will correctly compact the database (program file) if you have the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.