473,382 Members | 1,424 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,382 software developers and data experts.

Compact Access Database

All,

How do I go about compacting an Access XP database from VB code? I use a database for various reporting information and records are often deleted and created. The size of the database can grow large so I need to be able to compact the database from my VB app.

--
Thanks,
Brian P. Hammer
Nov 20 '05 #1
2 2980
Hello Brian,
How do I go about compacting an Access XP database
from VB code?


Check out the following link:

http://support.microsoft.com/default...b;en-us;306287

Hope this helps,
Len
Nov 20 '05 #2
-----Original Message-----
All,

How do I go about compacting an Access XP database from VB code? I use a database for various reporting
information and records are often deleted and created.
The size of the database can grow large so I need to be
able to compact the database from my VB app.
--
Thanks,
Brian P. Hammer

use DAO

if CnnTex.State = adStateOpen Then CnnTex.Close
strInPut = App.Path & "\Fabrica_Tex.Mdb"
strOutPut = App.Path & "\Fabrica_Tex1.Mdb"
If optDb(0) Then
Label1 = "Compressing Database..."
Screen.MousePointer = vbHourglass
'Kill strOutPut
DBEngine.CompactDatabase strInPut, strOutPut
Screen.MousePointer = vbDefault
NewName = App.Path & "\Fabrica_Tex2.Mdb"
Name strInPut As NewName
Name strOutPut As strInPut
Kill NewName
Label1 = "Database Successfully Compressed."
end if
end if
Nov 20 '05 #3

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

Similar topics

13
by: Larry L | last post by:
Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works great. Now after everyone's advice I split my...
3
by: Trevor Hughes | last post by:
Hello All I have a database (Access 2000, running on Win 2000), which suffers from bloat over a period of time. In order to solve the problem I set the option to compact on exit. This however...
3
by: Paolo | last post by:
Hi, I am trying to compact and repair my database, however every time I try it comes up a message saying: Table: "TempMSysAccessObject already exists", whenever I try to look for this table I...
6
by: MLH | last post by:
I just used Tools / Database Utilities / Compact Database in Access 97 for the first time. Unlike Access 2.0, it does not ask me to furnish a filename for it to compact into. It just launched...
6
by: owengoodhew | last post by:
Hi, I am responsible for maintaining an MS Access 97 Database that reliably becomes corrupt following a compact......... About the Database: The database is made up of three linked databases,...
5
by: Wayne | last post by:
I have been trying to get to the bottom of some bloating that I have in a frontend database. I started deleting objects a few at a time and have now deleted all objects and custom menu bars. The...
2
by: gibsonsgman | last post by:
hello, i have a question about compactin/repairing a database at runtime. i have code that will do this, but when it runs i get the error "You can't compact the open database while running a...
2
by: Ron | last post by:
Hi All, Using WinXP pro/Access 2000. I have a database that's been used for about 5 months. Transferred lots of data from a dos based program, then the users have been using it for that 5...
9
by: Ron | last post by:
New discovery. If I take a perfectly good database, and "compact/repair" on it with Access 2000 (seems to be at multiple sites--I've tried it with my system here, at another office on an...
29
by: Neil | last post by:
I would like to compact on close only if the database size goes over a certain amount, rather than each time. Thus, I'd like to check the file size and then perform the compact through code as the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.