?
Solved

Compacting Access Databases - Progress?

Posted on 1998-09-30
5
Medium Priority
?
469 Views
Last Modified: 2010-04-06
I can compact an Access database in my application by doing the following:

-------------------------------------------
Var
   Dao, DB1, DB2: Variant;
Begin
     Try
        Dao := CreateOLEObject('DAO.DBEngine.35');
        DB1 := sAppDir+'Database\Carval.mdb';
        DB2 := sAppDir+'Database\Compact.mdb';
        Dao.CompactDatabase(DB1,DB2);
     Finally
        Dao := unassigned;
     End;

     // Now delete the old table and rename the compacted table with the old name.
     DeleteFile(DB1);
     RenameFile(DB2,DB1);

------------------------------
This works. No problems there.

However, I would like to display some form of progress bar, just like when you select "Compact Database" in Access itself. How can I measure the progress of this function as it works and the max value for the bar?
0
Comment
Question by:jsweby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Author Comment

by:jsweby
ID: 1341287
Adjusted points to 100
0
 

Accepted Solution

by:
chrismo earned 200 total points
ID: 1341288
There's not a way to do this - this information is not exposed by the Jet.
0
 
LVL 4

Author Comment

by:jsweby
ID: 1341289
OK, fair enough, but there must be some way I can make the user think the progress bar is accurate. If you compact databases in Access the progress bar seems accurate enough, so what is a good way of doing this?

Cheat by all means. :-) Whatever it takes to make the bar LOOK like it is correct even if it just making it up.
0
 

Expert Comment

by:chrismo
ID: 1341290
My guess is, the Access GUI has a special 'in' that we, the developer, don't have.

One thing you could try to investigate = monitor the size of the output file during compression = although I'm not sure if Access creates the final output file as it compacts or only at the end.

The difficulty would be in knowing what the final size of the file is - so it'd be difficult to display a status bar type display. It would be more accurate to display # of bytes processed, or something like that. Or guesstimate the percentage of the original size the compacted database will be.
0
 
LVL 4

Author Comment

by:jsweby
ID: 1341291
Thanks for that.

I'm pretty sure that the output file is built up during compression and not just at the end so I could, as you say, monitor that and try and guess the final size it will be.

Cheers.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question