<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: MS Access: Restarting the database programmatically</title>
	<atom:link href="http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/</link>
	<description>Just another programming weblog</description>
	<pubDate>Thu, 28 Aug 2008 07:48:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Lu Anne</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8987</link>
		<dc:creator>Lu Anne</dc:creator>
		<pubDate>Wed, 13 Aug 2008 14:25:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8987</guid>
		<description>&lt;p&gt;&lt;pre&gt;&lt;code&gt;  Dim compactonclose As Variant
    compactonclose = Application.GetOption("Auto Compact")
    If compactonclose Then
        MsgBox "I am set to compact on close"
  End If
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;The above routine will detect if compact on close is selected. As for detecting when the database has actually closed, still working on that. I'll keep you posted.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><pre><pre><code>  Dim compactonclose As Variant
    compactonclose = Application.GetOption("Auto Compact")
    If compactonclose Then
        MsgBox "I am set to compact on close"
  End If
</code></pre></pre></p>

<p>The above routine will detect if compact on close is selected. As for detecting when the database has actually closed, still working on that. I&#8217;ll keep you posted.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Renaud</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8984</link>
		<dc:creator>Renaud</dc:creator>
		<pubDate>Wed, 13 Aug 2008 01:39:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8984</guid>
		<description>&lt;p&gt;@Lu: it's a good point. When access compacts on close it will take over its own restarting process and remove the database lock file.&lt;br /&gt;
In that case the batch file will assume that the database is closed and try to re-open it, which Access will not do since it is currently compacting.&lt;/p&gt;

&lt;p&gt;I'll see what can be done. My guess would be to try to detect whether the database is set to compact on close and find a way to detect when access has completed the compacting process.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Lu: it&#8217;s a good point. When access compacts on close it will take over its own restarting process and remove the database lock file.<br />
In that case the batch file will assume that the database is closed and try to re-open it, which Access will not do since it is currently compacting.</p>

<p>I&#8217;ll see what can be done. My guess would be to try to detect whether the database is set to compact on close and find a way to detect when access has completed the compacting process.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Lu Anne</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8983</link>
		<dc:creator>Lu Anne</dc:creator>
		<pubDate>Tue, 12 Aug 2008 16:14:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8983</guid>
		<description>&lt;p&gt;I am trying your restart function in Access 2003 - if I don't set the database to compact on close, the function works fiune. When I set the database to compact on close it never reopens the data abse. any suggestions?&lt;/p&gt;

&lt;p&gt;Thanks, Lu&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I am trying your restart function in Access 2003 - if I don&#8217;t set the database to compact on close, the function works fiune. When I set the database to compact on close it never reopens the data abse. any suggestions?</p>

<p>Thanks, Lu</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Renaud</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8973</link>
		<dc:creator>Renaud</dc:creator>
		<pubDate>Sat, 09 Aug 2008 05:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8973</guid>
		<description>&lt;p&gt;@Jacques: you make some valid points and I have updated the article, the code and test database to reflect these improvements and corrections.&lt;br /&gt;
Thanks for the comments.&lt;/p&gt;

&lt;p&gt;The test database for restarting the application is now available in Access2007 and Access2000 versions.&lt;br /&gt;
If someone could test the MDB version and let me know if it works properly or not I'd be grateful.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Jacques: you make some valid points and I have updated the article, the code and test database to reflect these improvements and corrections.<br />
Thanks for the comments.</p>

<p>The test database for restarting the application is now available in Access2007 and Access2000 versions.<br />
If someone could test the MDB version and let me know if it works properly or not I&#8217;d be grateful.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jacques</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8970</link>
		<dc:creator>Jacques</dc:creator>
		<pubDate>Fri, 08 Aug 2008 12:53:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8970</guid>
		<description>&lt;p&gt;Nice, simple and clean.&lt;/p&gt;

&lt;p&gt;A few comments:&lt;/p&gt;

&lt;p&gt;1) I realise you work with Access 2007 (with new extensions) - all previous versions use .mdb for the DB itself and .ldb for the lockfile - by adding the 'l' in line 3, it doesn't work for older versions (it should replace the 'm') - any idea how to make it generic?&lt;/p&gt;

&lt;p&gt;1a) Say you run a DB in execute-modus (extension = .accde) - then looking for the 'l'+'accde'-file is not going to work, as the lockfile will still be '.laccdb' - right?&lt;/p&gt;

&lt;p&gt;2) When Access crashes, it doesn't delete the lockfile - in case you run this batchfile and the .ldb not being removed, you end up in an infinite loop - not a resource-hog, I assume, but on creating this batchfile again (on restarting Access), you might run into trouble, as the previous batchfile is still present and you can't create a new batchfile with the same name. 
Perhaps you should build in some timer that self-deletes the batch file (after 2 minutes). And give batchfiles an unique name (e.g. incl. a timestamp).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice, simple and clean.</p>

<p>A few comments:</p>

<p>1) I realise you work with Access 2007 (with new extensions) - all previous versions use .mdb for the DB itself and .ldb for the lockfile - by adding the &#8216;l&#8217; in line 3, it doesn&#8217;t work for older versions (it should replace the &#8216;m&#8217;) - any idea how to make it generic?</p>

<p>1a) Say you run a DB in execute-modus (extension = .accde) - then looking for the &#8216;l&#8217;+'accde&#8217;-file is not going to work, as the lockfile will still be &#8216;.laccdb&#8217; - right?</p>

<p>2) When Access crashes, it doesn&#8217;t delete the lockfile - in case you run this batchfile and the .ldb not being removed, you end up in an infinite loop - not a resource-hog, I assume, but on creating this batchfile again (on restarting Access), you might run into trouble, as the previous batchfile is still present and you can&#8217;t create a new batchfile with the same name. 
Perhaps you should build in some timer that self-deletes the batch file (after 2 minutes). And give batchfiles an unique name (e.g. incl. a timestamp).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Renaud</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8961</link>
		<dc:creator>Renaud</dc:creator>
		<pubDate>Wed, 06 Aug 2008 02:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8961</guid>
		<description>&lt;p&gt;Hi Tony,&lt;br /&gt;
thanks for your message.&lt;/p&gt;

&lt;p&gt;Regarding the lock file, I assume that its deletion by Access is the last action performed once a database is closed, which would make sense since it's the whole purpose of a lock file.&lt;br /&gt;
I do not attempt to delete the lock file, Access does that; the last sentence of the batch file, the &lt;code&gt;DEL %0&lt;/code&gt; actually deletes the batch file itself to keep things clean.&lt;/p&gt;

&lt;p&gt;Thank you again for dropping by.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Tony,<br />
thanks for your message.</p>

<p>Regarding the lock file, I assume that its deletion by Access is the last action performed once a database is closed, which would make sense since it&#8217;s the whole purpose of a lock file.<br />
I do not attempt to delete the lock file, Access does that; the last sentence of the batch file, the <code>DEL %0</code> actually deletes the batch file itself to keep things clean.</p>

<p>Thank you again for dropping by.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Tony D'Ambra</title>
		<link>http://blog.nkadesign.com/2008/ms-access-restarting-the-database-programmatically/#comment-8960</link>
		<dc:creator>Tony D'Ambra</dc:creator>
		<pubDate>Wed, 06 Aug 2008 01:13:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nkadesign.com/?p=73#comment-8960</guid>
		<description>&lt;p&gt;Compliments on your  very elegant blog and code.&lt;/p&gt;

&lt;p&gt;A couple of months back I tackled the issue of forcing a restart by calling a VB6 EXE on an Access UNLOAD event and passing the database file path as a command-line parameter.  Now I can see your self-contained BAT file approach is better.  I used WAIT to delay the restart, and then trapped the Unable to Unlock File error in a resume loop until Access unlocked the MDB file and deleted the LDB file. I was wondering why in your code, you try deleting the LDB file outside Access?  Is there not a risk of corruption as the previous instance of Access would still exist until after its deletion of the LDB file?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Compliments on your  very elegant blog and code.</p>

<p>A couple of months back I tackled the issue of forcing a restart by calling a VB6 EXE on an Access UNLOAD event and passing the database file path as a command-line parameter.  Now I can see your self-contained BAT file approach is better.  I used WAIT to delay the restart, and then trapped the Unable to Unlock File error in a resume loop until Access unlocked the MDB file and deleted the LDB file. I was wondering why in your code, you try deleting the LDB file outside Access?  Is there not a risk of corruption as the previous instance of Access would still exist until after its deletion of the LDB file?</p>]]></content:encoded>
	</item>
</channel>
</rss>
