Compact Command

Ice Rhino

Registered User.
Local time
Today, 06:05
Joined
Jun 30, 2000
Messages
210
Hi

I posted some while ago a question regarding the growth of Access databases. Obviously the solution to those of us who have Access is to run the 'Compact' command.

However, I am writing a run-time application and the intention is that alot of the people will not have Access installed on their systems. There is a command under VBA, Runcommand.Compact which will obviously do the necessary, but you cant run it while the DB is open.

My questions are as follows

1. My only solution to this problem that I can think of is to tell the code to open another database, and then from within the new DB, compact the original

2. Is it possible to add two databases into ONe runtime application?

If the answer to these questions is yes, How do you do it?

Toni
 
I think you need to split your database. Have all the code, query, forms & reports in one database(your code DB) and all your tables in another your (data DB). Then Attach/Link all the tables in your Data DB to your Code DB. Now when you create your runtime Access database it will be based on the Code DB.

Then you should be able to write a sub that is executed from your Code DB that
1.Unattaches/Unlinks all the tables in the Data DB
2.Compacts the Data DB
3.reattaches/relinks the Data DB tables

But I'm not sure if the VBA command that you mentioned is gonna run on a machine that doesn't have Access installed on it, or worse, it may wreck the database if they have a different version of Access installed.
 
Try adding this to a command button SendKeys "%(TDC)", False
 

Users who are viewing this thread

Back
Top Bottom