MSG: Database already open when trying to compact??? 
Author Message
 MSG: Database already open when trying to compact???

A customer has a Visual Basic Application that updates several Access tables
in one .mdb.  In the application, they compact the database.  When the
compact code is AT THE END of the application (after the udpates had been
made) - it tries to execute the first line of code (that basically says
compact x database and save it as y database) it would give an error: You
attempted to open a database that is already opened by findiv123 (which is
the PC that runs the application on).  In processing, the database is opened
ONCE.  But right before running the compact code, the database is CLOSED.

Since we couldn't get the compact to work at the end, we moved it to the
beginning.  We still open the database ONCE and then close it, and then run
the compact code, and NOW THE COMPACT RUNS (as well as the rest of the
program).

Any reason why it would work this way???

Thanks, Krystal



Mon, 12 Aug 2002 03:00:00 GMT  
 MSG: Database already open when trying to compact???


Quote:
> A customer has a Visual Basic Application that updates several Access
tables
> in one .mdb.  In the application, they compact the database.  When the
> compact code is AT THE END of the application (after the udpates had
been
> made) - it tries to execute the first line of code (that basically
says
> compact x database and save it as y database) it would give an error:
You
> attempted to open a database that is already opened by findiv123
(which is
> the PC that runs the application on).  In processing, the database is
opened
> ONCE.  But right before running the compact code, the database is

CLOSED.

No, you issued a .Close but the database engine usually does not close
it immediately.  There is a timeout period to facilitate fast re-
opens.  If you are using DAO you can try setting all object references
for the database and recordsets/etc =Nothing and then also "Set
DBEngine=Nothing".  If that fails, or if you are not using DAO, search
for the connection timeout parameters and see if you can change them.

Quote:
> Since we couldn't get the compact to work at the end, we moved it to
the
> beginning.  We still open the database ONCE and then close it, and
then run
> the compact code, and NOW THE COMPACT RUNS (as well as the rest of the
> program).

> Any reason why it would work this way???

Sure, the database really is closed at that point.

--
Please reply via the newsgroup only

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 12 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Mail merge from Access try to open an already open DB

2. Compact Database already in use???

3. Error 2007 - you already have an open database object called xx - sub form problem

4. Is a database already open?

5. Checking if database already open

6. database already opened for exclusive use

7. Checking if a MDB database is already open

8. Checking if a MDB database is already open

9. Help with finding if my Access database is already open

10. Compact an open database programmatically

11. Help compact open database

12. Compacting a database w/out opening it

 

 
Powered by phpBB® Forum Software