<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Darragh Murray &#187; Ms Access Tips</title>
	<atom:link href="http://www.darraghmurray.com/category/ms-access-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darraghmurray.com</link>
	<description>Web location of Darragh Murray. Writer with interests in international relations, music, cultural history and Arsenal football club. Home of the UN Internship FAQ.</description>
	<lastBuildDate>Sun, 29 Jan 2012 22:54:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Testing a MS Access subreport for records</title>
		<link>http://www.darraghmurray.com/ms-access-tips/testing-a-ms-access-subreport-for-records/</link>
		<comments>http://www.darraghmurray.com/ms-access-tips/testing-a-ms-access-subreport-for-records/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 03:07:28 +0000</pubDate>
		<dc:creator>Darragh</dc:creator>
				<category><![CDATA[Ms Access Tips]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[Ms Access]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.darraghmurray.com/?p=1117</guid>
		<description><![CDATA[I haven&#8217;t done one of these in a long, long time, but I happen to be doing a bit of coding for a friend, and wanted to make a subreport control on an Access report invisible should it have no data. Of course, since I&#8217;ve been mostly out of the Access game for a while [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t done one of these in a long, long time, but I happen to be doing a bit of coding for a friend, and wanted to make a subreport control on an Access report invisible should it have no data. Of course, since I&#8217;ve been mostly out of the Access game for a while now, I was racking my brain for a bit, trying to figure it out and stumbling through a whole bunch of non-working solutions on the net. </p>
<p>But I eventually figured it out&#8230;.</p>
<p>Assuming you have a subreport control on a parent report called MySubReport and you want the subreport control to be not visible should it have no records, this is one option you can use. </p>
<blockquote><p>
Private Sub Report_Activate()<br />
    If Me.MySubReport.Report.HasData = False Then<br />
        Me.MySubReport.Visible = False<br />
    Else<br />
        Me.MySubReport.Visible = True<br />
    End If<br />
End Sub
</p></blockquote>
<p><em><strong>Report.hasData is the key!</strong></em></p>
<p>Many solutions on the Internet talk about using code like this in the IF..THEN expression:</p>
<blockquote><p>
Me.SubReport.Form.RecordSet.RecordCount = 0
</p></blockquote>
<p>Of course, that won&#8217;t work (we&#8217;re working with reports <strong>not forms</strong> and Microsoft inform us that the recordset object isn&#8217;t available in reports. If you try use the above, Access will keep throwing you errors like:</p>
<blockquote><p>
This feature is not available in an MDB.
</p></blockquote>
<p>I&#8217;ve tested this in Access 2007 and it seems to work fine.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/testing-a-ms-access-subreport-for-records/&via=darraghmurray&text=Testing a MS Access subreport for records&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/testing-a-ms-access-subreport-for-records/&via=darraghmurray&text=Testing a MS Access subreport for records&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.darraghmurray.com/ms-access-tips/testing-a-ms-access-subreport-for-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting Potential Errors when Using Transactions in Ms Access &#8211; Do NOT Close the Workspace!</title>
		<link>http://www.darraghmurray.com/ms-access-tips/troubleshooting-potential-errors-when-using-transactions-in-ms-access-do-not-close-the-workspace/</link>
		<comments>http://www.darraghmurray.com/ms-access-tips/troubleshooting-potential-errors-when-using-transactions-in-ms-access-do-not-close-the-workspace/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 05:13:06 +0000</pubDate>
		<dc:creator>Darragh</dc:creator>
				<category><![CDATA[Ms Access Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://www.darraghmurray.com/?p=192</guid>
		<description><![CDATA[I was doing some recordset juggling in vba and out of habit I usually close every object I open up explicit using the .close method on that object. For example if I open up a database using something like this Dim db as dao.database Set db = currentDb I will close it at the end [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some recordset juggling in vba and out of habit I usually close every object I open up explicit using the .close method on that object.</p>
<p>For example if I open up a database using something like this</p>
<p><code>Dim db as dao.database<br />
Set db = currentDb</code></p>
<p>I will close it at the end of the function or procedure</p>
<p><code>Db.close<br />
Set db = nothing</code></p>
<p>When using transactions, you make use of the workspace collection and you open it along the lines of</p>
<p><code>Dim myWrk as dao.workspace<br />
Set myWrk = DBEngine.Workspaces(0)</code></p>
<p>As usual, I want to close this at the end of the procedure along the lines of </p>
<p><code>myWrk.close<br />
set myWrk = nothing</code></p>
<p>This is were I went wrong</p>
<p>I was looping through a DAO recordset to check for conditions then make updates to a table. I wanted to make sure things didn’t screw up half way through so implemented some transactions, and then I started getting an error message</p>
<p><strong><code>Run-Time Error ‘3420’:<br />
Object Invalid or No Longer Set</code></strong></p>
<p>Specifically when I tried to use the .moveNext method of my recordset. </p>
<p>I began to tear my hair out! Google talks about updating my jet version, but that wasn’t the problem at all – I knew that I had the most up to date Jet engine.</p>
<p>It took me some time and a bit of research but I figured out it was happening when I made a call to another procedure while inside the recordset. Looking through the code, and nothing was wrong. I even pasted the code of the sub-procedure into my main procedure (minus all the variable setting and clean up objects stuff) and it work. Something was up in my sub procedures. </p>
<p>It was eventually a comment in <a href="http://allenbrowne.com/ser-37.html">this article on transactions at Allen Browne&#8217;s excellent Ms Access tips website</a> – <strong>I was explicitly closing the workspace. This is apparently a no-no. I deleted the .close line of code, and voila, it all worked!</strong></p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/troubleshooting-potential-errors-when-using-transactions-in-ms-access-do-not-close-the-workspace/&via=darraghmurray&text=Troubleshooting Potential Errors when Using Transactions in Ms Access - Do NOT Close the Workspace! &related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/troubleshooting-potential-errors-when-using-transactions-in-ms-access-do-not-close-the-workspace/&via=darraghmurray&text=Troubleshooting Potential Errors when Using Transactions in Ms Access - Do NOT Close the Workspace! &related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.darraghmurray.com/ms-access-tips/troubleshooting-potential-errors-when-using-transactions-in-ms-access-do-not-close-the-workspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ms Access &#8211; Percentage Field Formatting</title>
		<link>http://www.darraghmurray.com/ms-access-tips/ms-access-percentage-field-formatting/</link>
		<comments>http://www.darraghmurray.com/ms-access-tips/ms-access-percentage-field-formatting/#comments</comments>
		<pubDate>Mon, 12 Feb 2007 01:28:13 +0000</pubDate>
		<dc:creator>Darragh</dc:creator>
				<category><![CDATA[Ms Access Tips]]></category>

		<guid isPermaLink="false">http://www.darraghmurray.com/access-tips-solutions/ms-access-percentage-field-formatting/</guid>
		<description><![CDATA[A quick tip to fix what shouldn&#8217;t be a problem! Occasionally, Access can act rather confusingly. I ran into a typical example early this morning, when I was trying to get Access to allow entry of percentages correctly. I&#8217;ve done this about one thousand times before and probably solved this problem one thousand times as [...]]]></description>
			<content:encoded><![CDATA[<p>A quick tip to fix what shouldn&#8217;t be a problem!</p>
<p>Occasionally, Access can act rather confusingly. I ran into a typical example early this morning, when I was trying to get Access to allow entry of percentages correctly. I&#8217;ve done this about one thousand times before and probably solved this problem one thousand times as well, but every time it happens it causes me to scratch my head (mostly in disbelief).</p>
<p>What happens is this: You set up a field in a table, designate it to be formatted as percentage. Right OK &#8211; you go to your form design, set up your input fields, and then try to enter a number as a percentage, and notice that it keeps rounding to 100% or 0%. Frustration ++. </p>
<p>Back to table design. The problem here is that you have to correctly set the field data type as well as the data type format.  However, the data type is not integer, double, or even decimal &#8211; it is usually <strong>single</strong>. Once you set that on your percentage fields, you can enter data in decimal format (i.e. 0.5, 0.25 etc etc) and it will show up in its proper percent format. </p>
<p>I know this is shouldn&#8217;t be a problem but, amazingly, people get caught by it all the time, and there doesn&#8217;t seem to be clear answers on the web. Hopefully this tip does something to addressing this issue.</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/ms-access-percentage-field-formatting/&via=darraghmurray&text=Ms Access - Percentage Field Formatting&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://www.darraghmurray.com/ms-access-tips/ms-access-percentage-field-formatting/&via=darraghmurray&text=Ms Access - Percentage Field Formatting&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.darraghmurray.com/ms-access-tips/ms-access-percentage-field-formatting/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
	</channel>
</rss>

