Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoUpdate Not Compacting

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,<br>
<br>
I have written a procedure that automatically imports records from our mainframe then exports them to a differant table, it then deletes the old table data, and finally it renames the new tables. I was having problems with this method, as it kept saying the database had reached it's maximum size. I finally realized that I need to compact this database after each update, the problem is, I cannot seem to do this programmatically. The Code I am trying to use to do this is:<br>
<br>
'--------------------------------------------------------<br>
DoCmd.Close acForm, &quot;AutoUpdate&quot;, acSaveNo<br>
DBEngine.CompactDatabase &quot;\\Nt_server\driven\Secure IA\AutoUpdate.mdb&quot;, &quot;\\Nt_server\driven\Secure IA\AutoUpdateC.mdb&quot;<br>
'-------------------------------------------------------<br>
<br>
What happens when I run this code is that I get an <b>Error 3356</b> <span style=color:red>You attempted to open a database that is already opened exclusively by user &lt;name&gt; on machine &lt;name&gt;. </span>.<br>
<br>
What I am wondering is this, is there any way of actaully closing the database to do the compacting, from the code? It would see that if the database is closed, then the code is stopped.<br>
<br>
Any assistance would be greatly appreciated.<br>
<br>
TIA <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= HomePage</a><br>WebMaster - DataBase Administrator - Programmer<br>
 
You can not compact an open database using code.<br>
<br>
Sorry<br>
RDH
 
Why don't you write a routine that opens another database which has for the startup form a routine that compacts your main database. What you would actually do would be to call the other db, then close the main db.By the time the second db opened and started it's thing, the first will allready be closed and ready for compacting.
 
Another way is to call the the import procedure and the compact procedure as command-line (launching Access) options from the DOS environment. We used to use Microsoft Agent to schedule late-night jobs like these when no users were on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top