<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Microsoft Access Team Blog : Power Tips</title><link>http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx</link><description>Tags: Power Tips</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Use late binding to improve the performance of tabbed forms</title><link>http://blogs.msdn.com/access/archive/2009/12/09/use-late-binding-to-improve-the-performance-of-tabbed-forms.aspx</link><pubDate>Wed, 09 Dec 2009 18:03:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9934709</guid><dc:creator>cdowns</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/access/comments/9934709.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9934709</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Luke Chung, President and Founder of FMS, Inc., has written and presented a wide range of topics related to Access over the years. In addition to their many Access related products, FMS offers a wealth of great Access &lt;/strong&gt;&lt;a href="http://www.fmsinc.com/tpapers/index.html"&gt;&lt;strong&gt;papers&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, &lt;/strong&gt;&lt;a href="http://www.fmsinc.com/free/tips.html"&gt;&lt;strong&gt;tips&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, and &lt;/strong&gt;&lt;a href="http://www.fmsinc.com/videos/index.asp"&gt;&lt;strong&gt;video&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; on their site.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you use the Tab Control to pack a lot of controls onto a form, here is a great tip to make the form load more quickly. The secret is in keeping most of the controls unbound until you need them. For example, on the form shown below, you could keep the controls on the &lt;strong&gt;Address&lt;/strong&gt;, &lt;strong&gt;Telephone&lt;/strong&gt;, and &lt;strong&gt;Other info&lt;/strong&gt; tabs unbound until you click the tabs.&lt;/p&gt;  &lt;h6&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Uselatebindingtoimprovetheperformanceoft_8D82/3_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="A tab control on a form" border="0" alt="A tab control on a form" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Uselatebindingtoimprovetheperformanceoft_8D82/3_thumb.jpg" width="428" height="204" /&gt;&lt;/a&gt;&lt;/h6&gt;  &lt;p&gt;&lt;a href="http://www.fmsinc.com/microsoftaccess/Performance/Forms/LateBinding.asp" target="_blank"&gt;Check out this tip on the FMS site!&lt;/a&gt;&lt;/p&gt;  &lt;h6&gt;Become a guest blogger on the Access Team Blog! Send your Power Tips to Chris and Mike at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9934709" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/User+Interface/default.aspx">User Interface</category><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category><category domain="http://blogs.msdn.com/access/archive/tags/Performance/default.aspx">Performance</category></item><item><title>The Cartesian product: a feature, not a bug</title><link>http://blogs.msdn.com/access/archive/2009/11/30/the-cartesian-product-a-feature-not-a-bug.aspx</link><pubDate>Mon, 30 Nov 2009 23:46:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9930456</guid><dc:creator>cdowns</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/access/comments/9930456.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9930456</wfw:commentRss><description>&lt;p&gt;&lt;b&gt;Today's guest blogger is Access MVP Garry Robinson, who offers up another gem from the Smart Access collection of articles at &lt;/b&gt;&lt;a href="http://www.vb123.com/kb"&gt;&lt;b&gt;http://www.vb123.com/kb&lt;/b&gt;&lt;/a&gt;&lt;b&gt;.&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;In this article written by Peter Vogel, you will be given an overview about what it means to write queries where tables are not joined. This is a good thing to know because SQL queries written this way can help you now in exactly the same way as it did for Peter and I working on projects in the last century. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Article by Peter Vogel from 1997&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;When we first started using Access as our company’s end-user reporting tool, there were some unfortunate incidents. In one of those incidents, our president put two tables, each with about 100,000 records, in a query and clicked the Run button. His computer rumbled for about five minutes, sighed deeply, and locked up. So he did it again. After the fourth or fifth time, he decided that this repeated failure wasn’t accidental and called me to fix it.&lt;/p&gt;  &lt;p&gt;What was happening, of course, was that he had failed to join any fields in the first table to any of the fields in the second table. When you put two tables in the same query without joining them, SQL’s default behavior is to give you a recordset that contains every combination of every record in both tables. This type of result set is called a Cartesian product. Because we had more than 100,000 records in each of the tables in this example, the big sigh the computer was making occurred when it discovered there wasn’t enough memory to hold the 10 billion records he was generating. In mathematical circles, this is known as the &amp;quot;law of large numbers:&amp;quot; if you multiply one large number by another large number you get a humongous number.&lt;/p&gt;  &lt;p&gt;I explained what was happening and my boss’ immediate reaction was the one that most users have: he was the victim of a bug. I don’t think I ever really convinced him that it wasn’t a bug and that he had discovered the fundamental behavior that makes SQL work.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;How SQL works&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Back in the bad old days, there was no special SQL syntax for joining two tables together. Instead of using the Join keyword and coding this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; * 
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; Table1 
&lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt; Table2 &lt;span class="kwrd"&gt;ON&lt;/span&gt; Table1.Field1 = Table2.Field2;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;you simply added a Where clause to the SQL statement:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; * 
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; Table1 , Table2 
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; Table1.Field1 = Table2.Field2;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;It’s important to see this in light of SQL’s default behavior. Simply putting two tables in a query like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; * &lt;span class="kwrd"&gt;FROM&lt;/span&gt; Table1, Table2;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;generates every possible combination of the rows in the two tables. A Where clause specifies which rows, out of all of those combinations, you’re interested in. In the sample case, it’s just the ones where Table1.Field1 equals Table2.Field2.&lt;/p&gt;

&lt;p&gt;The Join keyword was added primarily to make it easier for query optimizers to determine the best strategy for retrieving the records—and also to introduce a standardized way of specifying outer joins (which every SQL implementation seemed to do differently). While the query optimizer may use the Join clause to work out some arcane way of retrieving the data, for the result to be valid it must match the result you would get if you generated every possible combination of rows and then went through those rows winnowing out the ones that don’t match the various Where clauses.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Useful results and No Joins Can Be A Feature&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you have to write your SQL code using Where clauses to specify how the tables in the query are related. If you’re joining two fields of incompatible types, for instance, you have no choice. If Field1 is a string and Field2 is an integer you can’t just drag Field1 over to Field2 in the Query Design window (well, you can, but the resulting query won’t run). What you have to do, after adding both tables to the query, is pull Field1 down to the query grid and give it a criteria of CStr([Field2]). The resulting SQL would look like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; Table1.Field1, * 
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; Table1, Table2Num 
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; Table1.Field1=CStr([Field2]);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This harks back to the original SQL method for joining tables.&amp;#160;&amp;#160; There are even occasions when you don’t want to join the tables in a query because you want to exploit the default behavior. This may occur when you’re loading a table with data. For instance, I have been trying to find a simple way to generate a round robin schedule for a hockey tournament. The first step of our solution is to load the tblGames table with all the possible games that could result from the teams in the tblTeams table playing each other. We do this by putting two unjoined copies of the Teams table in the same MakeTable query:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; tblTeam.TeamName, tblTeam_1.TeamName 
&lt;span class="kwrd"&gt;INTO&lt;/span&gt; tblCombinations 
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; tblTeam, tblTeam &lt;span class="kwrd"&gt;AS&lt;/span&gt; tblTeam_1;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This query creates a table of all the possible team combinations, including some impossible ones where a team ends up playing itself.&lt;/p&gt;

&lt;p&gt;Here’s another example: at my company we have to keep track of the road graders we’re building. We build a grader in 65 separate steps and when a step is completed, we check off that step for that grader. I built the table for recording this information by using a query that takes a table of all the graders to be added and a table of every step, and then exploits SQL’s default behavior:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; tblStatus(Grader,Step) 
&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; * &lt;span class="kwrd"&gt;FROM&lt;/span&gt; tblNewGraders, tblStepList&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Once the table is built, recording progress is just a matter of the guys on the shop floor checking off each row as the grader finishes each step. It’s like I told my boss, when his computer kept blowing up trying to generate 10 billion records: &amp;quot;It isn’t a bug, it’s a feature.&amp;quot; I don’t think he appreciated the usefulness of Cartesian product joins, but he had a memorable introduction to the fundamental nature of SQL. &lt;/p&gt;

&lt;p&gt;If you like this article, read how Garry put this theory to good use in producing X-Y Grid queries for mining companies:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.vb123.com/kb/200003_gr_space.htm"&gt;http://www.vb123.com/kb/200003_gr_space.htm&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;Become a guest blogger! Submit your tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9930456" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Add color formatting to columns in Combo Boxes and List Boxes</title><link>http://blogs.msdn.com/access/archive/2009/11/17/add-color-formatting-to-columns-in-combo-boxes-and-list-boxes.aspx</link><pubDate>Tue, 17 Nov 2009 18:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9923697</guid><dc:creator>cdowns</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/access/comments/9923697.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9923697</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today's guest blogger is Pavlo Pedan of ARGO Business Corp. He has 15 years of experience with Access and has a great site of tips&amp;#160; at &lt;/strong&gt;&lt;a href="http://sites.google.com/site/msaccesscode/"&gt;&lt;strong&gt;http://sites.google.com/site/msaccesscode/&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As we all know, a List Box control has a Fore Color property. It sets the fore color for column values and headers simultaneously. Also, we know that table and query fields have a &lt;a href="http://office.microsoft.com/en-us/access/HA012327471033.aspx"&gt;Format property&lt;/a&gt;, where color formatting can be set. For example, you can format a number field as &lt;strong&gt;0.00[Green].&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As stated in Access 97, 2003 and 2007 help, &amp;quot;If you set a field's &lt;strong&gt;Format&lt;/strong&gt; property in table Design view, Microsoft Access uses that format to display data in datasheets. It also applies the field's &lt;strong&gt;Format&lt;/strong&gt; property to new controls on forms and reports.&amp;quot; &lt;/p&gt;  &lt;p&gt;So when creating a new Text Box control, the Text Box inherits the underlying field's Format property. However, List Boxes and Combo Boxes can also inherit this color formatting. And, it works for existing controls as well as new ones. You can change the Format property for a table field, and the new color will be inherited by an existing control (Text Box, List Box, or Combo Box). &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Addcolorformattingtocolumnsincomboboxesa_752C/7_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="7" border="0" alt="7" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Addcolorformattingtocolumnsincomboboxesa_752C/7_thumb.jpg" width="366" height="315" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The strange thing is, the List Box control has no Format property, and the Format property for the Combo Box control is not changed by the Format property of the underlying field. See a sample database &lt;a href="http://cid-f83d4d33f0a1a23a.skydrive.live.com/self.aspx/Sample%20Databases/ListBoxColumnsColors.accdb"&gt;here&lt;/a&gt; for some examples. &lt;/p&gt;  &lt;p&gt;Using color formatting for list boxes and combo boxes definitely makes an application more attractive. One can set different columns into different colors, set different colors for header and items, and use a type of conditional formatting for empty values. For example, the Format property for Field2 in the picture above is: &lt;strong&gt;[Blue];@;&amp;quot;Empty&amp;quot;[Magenta]&lt;/strong&gt;. This formatting overrides the Fore Color property of the control. &lt;/p&gt;  &lt;p&gt;Such formatting is applicable not only for underlying tables, but for queries as well. Therefore, by choosing different queries for different List Boxes, we can have different sets of colors while referencing the same table.&lt;/p&gt;  &lt;p&gt;However, some limitations apply. The above only seems to work for Access 97 and 2007 (and 2010?) but not for 2003. Also, it seems to work only for Text and Memo fields. &lt;/p&gt;  &lt;p&gt;Have you experimented with this? If so, please post a comment! &lt;/p&gt;  &lt;p&gt;Thank you,    &lt;br /&gt;Pavlo&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923697" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Sorting a Listbox Using Command Buttons</title><link>http://blogs.msdn.com/access/archive/2009/11/13/sorting-a-listbox-using-command-buttons.aspx</link><pubDate>Fri, 13 Nov 2009 23:28:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922317</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/access/comments/9922317.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9922317</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today’s guest blogger is Daniel Lamarche. &lt;b&gt;Daniel is the Training Director at &lt;a href="http://www.comboprojects.com/index.html"&gt;ComboProjects&lt;/a&gt;, which specializes in providing custom training solutions in Microsoft Office products.&lt;/b&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I always thought it was cool to be able to sort a list by clicking the column heading once, for ascending order then once more for descending order.&lt;/p&gt;    &lt;p&gt;A while ago I decided to tackle this feature in an Access form.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/SortingaListboxUsingCommandButtons_D921/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/SortingaListboxUsingCommandButtons_D921/clip_image002_thumb.jpg" width="324" height="316" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;The buttons above the field names are used to sort the list. The triangle pointing down means the column is in descending order.&lt;/p&gt;    &lt;p&gt;Clicking on it again will sort that column in ascending order and the triangle will be pointing up. Like you are used to.&lt;/p&gt;    &lt;p&gt;This project required a basic understanding of Access SQL and concatenating strings.&lt;/p&gt;    &lt;p&gt;When you configure the Listbox using the Row Source property to specify the data that will appear in the list you are in fact creating a SQL statement.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Read the rest of the article and download a sample database here: &lt;a href="http://www.comboprojects.com/articles/accSortingList/accSortingListbox.html"&gt;http://www.comboprojects.com/articles/accSortingList/accSortingListbox.html&lt;/a&gt;&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922317" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Displaying Data From Related Tables on a Form</title><link>http://blogs.msdn.com/access/archive/2009/11/06/displaying-data-from-related-tables-on-a-form.aspx</link><pubDate>Fri, 06 Nov 2009 22:12:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9918857</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/access/comments/9918857.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9918857</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today's guest blogger is Access MVP Scott Diamond. Scott is the principal of &lt;/strong&gt;&lt;a href="http://www.diamondassoc.com/"&gt;&lt;strong&gt;Diamond Computing Associates&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; and the author of &lt;/strong&gt;&lt;a href="http://www.informit.com/store/product.aspx?isbn=0789737310"&gt;&lt;strong&gt;Microsoft Office Access 2007 VBA&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;This is a very frequently discussed issue. But before I get into the methods, you need to understand one of the principles of relational databases. That principle is that data should exist in one place only. Having the same data in multiple tables is a violation of normalization. Related records are indicated by a Foreign Key within the record that holds the Primary Key value of the parent record. So when you want to have data from multiple tables on a data entry form, you set it up to display the data not store it in the form’s &lt;a href="http://msdn.microsoft.com/en-us/library/bb216003.aspx"&gt;RecordSource&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;There are basically four ways to display related data on a form; Subforms, the Column property, DLookups and Listboxes. Ill discuss each in turn and suggest where to use each.&lt;/p&gt;  &lt;h4&gt;Subforms&lt;/h4&gt;  &lt;p&gt;You can use a subform to display several fields from the related table. Create the form using the Subform wizard or create a separate form and place it on the main form as a subform (I generally create a separate form). Using the wizard, you go through the following steps.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Select whether to use an existing form or create a new one &lt;/li&gt;    &lt;li&gt;If you are creating select the table and fields to use &lt;/li&gt;    &lt;li&gt;Select the linking fields, usually accept the defaults Access proposes &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;You can customize the subform, so it looks like part of the main form, by removing record selectors, navigation buttons, borders etc. I use subforms when I want to display 4 or more fields from the related record. Another advantage of using subforms is where you have a One to Many relation. Using a Continuous Form or Datasheet View, you can display multiple related records at once.&lt;/p&gt;  &lt;h4&gt;Column Property&lt;/h4&gt;  &lt;p&gt;Generally Foreign Keys are entered by selecting the related value from a combobox. The combobox uses a query as it Rowsource. This query displays the records from that parent table. At the least, the query includes the primary key field as its bound column and a description field. However, you can add as many other fields from the table as you want. These fields can then be reference using the Column property. Click the Build button […] next to the Rowsource property to enter Query Design Mode. In Query Design Mode you can add tables and fields to the query. You can control what fields actually display in the pull down list by setting their Column Width. Setting the width of an individual column to 0&amp;quot; will hide that column (Note: Column widths are entered separated by a ; for each column listed in the column Count). The combobox will only display the first non zero length column after selection. The following properties of a combo are key to using combos in this way: RowSource (the list), Bound column (what's actual stored), Column Count (how many columns in the list, Column Widths (the size of each column in the list).&lt;/p&gt;  &lt;p&gt;You can then set the ControlSource for an unbound control to:&lt;/p&gt;  &lt;p&gt;[comboxname].Column(x)&lt;/p&gt;  &lt;p&gt;Where comboxname is the name of the control and x is the number of the column in the query for that field. Note: the column count starts with 0 so the 3rd column is 2.&lt;/p&gt;  &lt;p&gt;Since the combobox selects a single record, the Column property will also reflect a single record. I use this method if I need to display 3 or less values from the related record.&lt;/p&gt;  &lt;h4&gt;DLookups&lt;/h4&gt;  &lt;p&gt;DLookups allow you pull a value from a field in a specific record. It uses the syntax: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb148913.aspx"&gt;DLookup&lt;/a&gt;([fieldname],table/queryname,Criteria). &lt;/p&gt;  &lt;p&gt;The Criteria is used to specify the record you want to return. Since the Comboxname will store the Foreign Key value you would use a criteria like: &lt;/p&gt;  &lt;p&gt;[keyfield] = &amp;amp; [Comboboxname]. &lt;/p&gt;  &lt;p&gt;This would also be used as the controlsource of an unbound control. Each DLookup should only be returning data from a single record. If its possible that the DLookup might not find a matching record you should use it within a NZ (NullZero) function to prevent errors. I use DLookups when I need to pull data from different tables based on a key value.&lt;/p&gt;  &lt;h4&gt;Listboxes&lt;/h4&gt;  &lt;p&gt;A Listbox can have multiple columns with column headers. It also can be set to display multiple matching records. I will, sometimes, use a Listbox in place of a continuous form or datasheet subform. Listboxes will also display multiple matching records.&lt;/p&gt;  &lt;p&gt;There are two exceptions to the rule of not repeating data in multiple tables. The first is the PK value. Obviously, that value has to be repeated as the FK to relate the records to each other. The other exception is time sensitive data. Sometimes you need to freeze data that will change over time. The best example of this is price data. For example: In an order entry application, you want to freeze the price at the time of the order. In such a case, you would have the Price field repeated in the OrderDetails table. Generally you would use the Column property for this and populate the control in the After Update event of the Products combo use code like:&lt;/p&gt;  &lt;p&gt;Me.txtPrice = Me.cboProduct.Column(2)&lt;/p&gt;  &lt;p&gt;These guidelines should help you build forms that preserve normalization and are well organized and easy for the user to use.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918857" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>A better way to reference tab control pages</title><link>http://blogs.msdn.com/access/archive/2009/11/05/a-better-way-to-reference-tab-control-pages.aspx</link><pubDate>Fri, 06 Nov 2009 02:38:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9918357</guid><dc:creator>cdowns</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/access/comments/9918357.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9918357</wfw:commentRss><description>&lt;p&gt;In VBA, a common way to refer to the pages of a tab control is to use the &lt;strong&gt;Value&lt;/strong&gt; property. However, Luke Chung, President of FMS Inc., recommends using the &lt;strong&gt;PageIndex&lt;/strong&gt; property instead. &lt;a href="http://www.fmsinc.com/microsoftaccess/forms/tabs"&gt;Click here&lt;/a&gt; to find out why! &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Abetterwaytoreferencetabcontrolpages_1063A/tabs_4.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="tabs" border="0" alt="tabs" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Abetterwaytoreferencetabcontrolpages_1063A/tabs_thumb_1.jpg" width="504" height="275" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918357" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/User+Interface/default.aspx">User Interface</category><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Convert hexadecimal color codes so you can use them in code</title><link>http://blogs.msdn.com/access/archive/2009/10/26/convert-hexadecimal-color-codes-so-you-can-use-them-in-code.aspx</link><pubDate>Mon, 26 Oct 2009 15:14:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912963</guid><dc:creator>cdowns</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/access/comments/9912963.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9912963</wfw:commentRss><description>&lt;h5&gt;Today's guest blogger is Michael Merlin, Lead Software Developer at &lt;a href="http://ecoms.com" target="_blank"&gt;Electronic Communities&lt;/a&gt;. &lt;/h5&gt;  &lt;p&gt;I recently wasted an hour trying to set a field's Back Color property to the hex code generated by the color picker. I figured it out after some searching, but still nobody online had the exact correct answer. I wrote a function that lets you easily use the hex color in code. The secret is to swap the R and the B, and then convert the hex to long. Further explanation follows in the comments of the function.&lt;/p&gt;  &lt;p&gt;Cheers!    &lt;br /&gt;Michael&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt; HexColor(strHex &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;) &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Long&lt;/span&gt;

    &lt;span class="rem"&gt;'converts Hex string to long number, for colors&lt;/span&gt;
    &lt;span class="rem"&gt;'the leading # is optional&lt;/span&gt;

    &lt;span class="rem"&gt;'example usage&lt;/span&gt;
    &lt;span class="rem"&gt;'Me.iSupplier.BackColor = HexColor(&amp;quot;FCA951&amp;quot;)&lt;/span&gt;
    &lt;span class="rem"&gt;'Me.iSupplier.BackColor = HexColor(&amp;quot;#FCA951&amp;quot;)&lt;/span&gt;

    &lt;span class="rem"&gt;'the reason for this function is to programmatically use the&lt;/span&gt;
    &lt;span class="rem"&gt;'Hex colors generated by the color picker.&lt;/span&gt;
    &lt;span class="rem"&gt;'The trick is, you need to reverse the first and last hex of the&lt;/span&gt;
    &lt;span class="rem"&gt;'R G B combination and convert to Long&lt;/span&gt;
    &lt;span class="rem"&gt;'so that if the color picker gives you this color #FCA951&lt;/span&gt;
    &lt;span class="rem"&gt;'to set this in code, we need to return CLng(&amp;amp;H51A9FC)&lt;/span&gt;
    
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; strColor &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; strR &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; strG &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; strB &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;
    
    &lt;span class="rem"&gt;'strip the leading # if it exists&lt;/span&gt;
    &lt;span class="kwrd"&gt;If&lt;/span&gt; Left(strHex, 1) = &lt;span class="str"&gt;&amp;quot;#&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;Then&lt;/span&gt;
        strHex = Right(strHex, Len(strHex) - 1)
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;If&lt;/span&gt;
    
    &lt;span class="rem"&gt;'reverse the first two and last two hex numbers of the R G B values&lt;/span&gt;
    strR = Left(strHex, 2)
    strG = Mid(strHex, 3, 2)
    strB = Right(strHex, 2)
    strColor = strB &amp;amp; strG &amp;amp; strR
    HexColor = &lt;span class="kwrd"&gt;CLng&lt;/span&gt;(&lt;span class="str"&gt;&amp;quot;&amp;amp;H&amp;quot;&lt;/span&gt; &amp;amp; strColor)

&lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912963" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Report/default.aspx">Report</category><category domain="http://blogs.msdn.com/access/archive/tags/User+Interface/default.aspx">User Interface</category><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Running an Access Parameter Query from Excel</title><link>http://blogs.msdn.com/access/archive/2009/10/23/running-an-access-parameter-query-from-excel.aspx</link><pubDate>Fri, 23 Oct 2009 08:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911866</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/access/comments/9911866.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9911866</wfw:commentRss><description>&lt;p&gt;Excel MVP Michael Alexander wanted to share this tip about running an Access parameter query from Excel. He describes the problem thusly:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;An Access parameter query is a kind of interactive query that prompts you for criteria before the query is run. Parameter queries are useful when you need to ask the query different questions using different criteria each time you run it.&lt;/p&gt;    &lt;p&gt;Now we all know you can pull data from Access into Excel using MS Query. The problem is that MS Query doesn't let you pull in Parameter queries. There may be a technical reason for this, but I like to think it's just Microsoft's way of keeping things interesting. After all, technical roadblocks are the spice of life.      &lt;br /&gt;If you've had enough spice, I'll show you a VBA workaround that will enable you to run an Access parameter query from Excel.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://datapigtechnologies.com/blog/index.php/running-an-access-parameter-query-from-excel/"&gt;Click over to Michael’s blog&lt;/a&gt; to learn about his solution to the problem.&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911866" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Expand only the subdatasheets you want</title><link>http://blogs.msdn.com/access/archive/2009/10/21/expand-only-the-subdatasheets-you-want.aspx</link><pubDate>Wed, 21 Oct 2009 15:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9910662</guid><dc:creator>cdowns</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/access/comments/9910662.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9910662</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today's guest blogger is Pavlo Pedan of ARGO Business Corp. He has 15 years of experience with Access and has a great site of tips&amp;#160; at &lt;/strong&gt;&lt;a href="http://sites.google.com/site/msaccesscode/"&gt;&lt;strong&gt;http://sites.google.com/site/msaccesscode/&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you have a form that contains subdatasheets, you can use the following VBA command to expand all of them:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Forms![FormName]![SubFormName].Form.SubdatasheetExpanded = True&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;However, we often want only &lt;em&gt;some&lt;/em&gt; of the subdatasheets to be expanded, based on     &lt;br /&gt;some criteria (for example - expand only if subdatasheets contain data.) &lt;/p&gt;  &lt;p&gt;Watch a short video demo and download a demo database &lt;a href="http://sites.google.com/site/msaccesscode/forms-1/expandonesubformlineindatasheetviewcriteriabased" target="_blank"&gt;from this page&lt;/a&gt;. Make sure you have added a reference to the &amp;quot;Accessibility&amp;quot; library (%windir%\system32\oleacc.dll). &lt;/p&gt;  &lt;p&gt;This has been tested on Access 2007.&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9910662" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/User+Interface/default.aspx">User Interface</category><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Using the ShowToolbar Method to Hide the Ribbon</title><link>http://blogs.msdn.com/access/archive/2009/10/16/using-the-showtoolbar-method-to-hide-the-ribbon.aspx</link><pubDate>Fri, 16 Oct 2009 21:31:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9908394</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/access/comments/9908394.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9908394</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today’s guest blogger is Edwin Blancovitch. Edwin is president of &lt;/strong&gt;&lt;a href="http://advdev.net/"&gt;&lt;strong&gt;Advanced Developers.net&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, creators of &lt;/strong&gt;&lt;a href="http://www.easypayroll.net/"&gt;&lt;strong&gt;Easy Payroll&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, a software package to manage your human resources, payroll, scheduling, time and attendance needs.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I have been using the ribbon for the last two years and I like it so much, however there was a situation where I wanted to hide the ribbon. I used the Minimize the Ribbon command to hide it, but there was still some space being used by the Office button and the ribbon tabs. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/4c8309168de3_D515/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/4c8309168de3_D515/image_thumb_1.png" width="364" height="182" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After some experimentation and some research I found that I could use the &lt;a href="http://msdn.microsoft.com/en-us/library/bb214112.aspx"&gt;ShowToolbar&lt;/a&gt; method to hide the ribbon. The following line of code makes the ribbon disappear completely, and allows you to see the application like in Office 2003, without the command bars. &lt;/p&gt;  &lt;pre class="csharpcode"&gt;DoCmd.ShowToolbar &lt;span class="str"&gt;&amp;quot;Ribbon&amp;quot;&lt;/span&gt;, acToolbarNo&lt;/pre&gt;
&lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;That will make the ribbon disappear completely, and allow you to see the application like in Office 2003, without the command bars.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/4c8309168de3_D515/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/4c8309168de3_D515/image_thumb_2.png" width="364" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;To display the ribbon again, use this code:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;DoCmd.ShowToolbar &lt;span class="str"&gt;&amp;quot;Ribbon&amp;quot;&lt;/span&gt;, acToolbarYes&lt;/pre&gt;
&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/access/archive/2009/05/21/how-to-create-a-shortcut-menu-for-a-form-form-control-or-report.aspx"&gt;I wrote an article&lt;/a&gt; a long time ago for creating context command bars with VBA code, now it will be great to experiment by creating new command bars that go in the top menu. You can use context command bars in your forms, and make it work the way you wanted.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9908394" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Nulls vs. zero-length strings: a Power Tip from the past</title><link>http://blogs.msdn.com/access/archive/2009/10/14/nulls-vs-zero-length-strings-a-power-tip-from-the-past.aspx</link><pubDate>Wed, 14 Oct 2009 18:48:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907281</guid><dc:creator>cdowns</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/access/comments/9907281.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9907281</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today's guest blogger is Access MVP Garry Robinson, who offers the Smart Access collection of articles at &lt;/strong&gt;&lt;a href="http://www.vb123.com/kb"&gt;&lt;strong&gt;http://www.vb123.com/kb&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;A few months ago I purchased the rights to publish the Smart Access magazine online and it is from that collection that I offer this tip from Paul Litwin, the first editor of Smart Access. At the end of that I provide a link to an editorial on Null Values written by the second editor Peter Vogel. It never hurts to get a refresher course on Null values, a necessary evil for database developers.&lt;/p&gt;  &lt;h5&gt;Tip by Paul Litwin from 1997 &lt;/h5&gt;  &lt;p&gt;Even though Access considers Nulls and zero-length strings (ZLS) separate values, often developers wish to treat them as equivalent for the sake of an &lt;strong&gt;If...Then&lt;/strong&gt; statement or some other stretch of code. One way to accomplish this is to write code like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' Not so efficient &lt;/span&gt;
&lt;span class="kwrd"&gt;If&lt;/span&gt; IsNull(varAge) &lt;span class="kwrd"&gt;or&lt;/span&gt; varAge = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;Then&lt;/span&gt;
     &lt;span class="rem"&gt;' do something &lt;/span&gt;
&lt;span class="kwrd"&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;A better way to do this is:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' More efficient &lt;/span&gt;
&lt;span class="kwrd"&gt;If&lt;/span&gt; Len(varAge &amp;amp; &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;) = 0 &lt;span class="kwrd"&gt;Then&lt;/span&gt;
     &lt;span class="rem"&gt;' do something &lt;/span&gt;
&lt;span class="kwrd"&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This second version of the code is more efficient for two reasons. First, if &lt;strong&gt;varAge&lt;/strong&gt; is Null, the code converts it into a ZLS by appending a ZLS to it. This lets us replace two tests with one. Second, it’s simply more efficient to check for a ZLS using Len(ZLS) = 0 rather than ZLS=&amp;quot;&amp;quot;.&lt;/p&gt;

&lt;p&gt;You can use a variation of this technique if you ever need to place the value of a text box or a variant variable into a string. Strings can’t contain Null values, so you may be tempted to write code like this that first checks to see if the text box is Null:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' Another correct but slow method &lt;/span&gt;
&lt;span class="kwrd"&gt;If&lt;/span&gt; IsNull(txtAge) &lt;span class="kwrd"&gt;Then&lt;/span&gt;
     strAge = &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt; 
&lt;span class="kwrd"&gt;Else&lt;/span&gt;     
     strAge = txtAge 
&lt;span class="kwrd"&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;A much faster way to do this is to use code like this instead:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' This is faster &lt;/span&gt;
strAge = txtAge &amp;amp; &lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This code avoids doing the test altogether by setting the value to the concatenation of the text box and a ZLS. If the text box is Null, this converts it into a ZLS. If the text box is either a ZLS or a regular value, then the concatenation has no effect. &lt;/p&gt;

&lt;p&gt;Read more on Nulls in Peter Vogels editorial here &lt;a href="http://www.vb123.com/kb/200207_pv_ed.htm"&gt;http://www.vb123.com/kb/200207_pv_ed.htm&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907281" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Identifying the Record Selected on a Continuous Form</title><link>http://blogs.msdn.com/access/archive/2009/10/07/identifying-the-record-selected-on-a-continuous-form.aspx</link><pubDate>Wed, 07 Oct 2009 02:03:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9904028</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>20</slash:comments><comments>http://blogs.msdn.com/access/comments/9904028.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9904028</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today’s guest blogger is Edwin Blancovitch. Edwin is president of &lt;/strong&gt;&lt;a href="http://advdev.net/"&gt;&lt;strong&gt;Advanced Developers.net&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, creators of &lt;/strong&gt;&lt;a href="http://www.easypayroll.net/"&gt;&lt;strong&gt;Easy Payroll&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, a software package to manage your human resources, payroll, scheduling, time and attendance needs.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Regularly when we create databases for our customers we use continuous forms for data entry. The problem is, it’s often difficult for users to identify the record they’re working on a big continuous form with tons of records.&lt;/p&gt;  &lt;p&gt;I’ve found a way to overcome this in just a few just quick steps that I’d like to share with you guys.&lt;/p&gt;  &lt;p&gt;This is fully compatible with previous versions of Access, because I have been doing this my whole life. Actually, I just found it by mistake, while trying to create a conditional formatting event. We can do this with conditional formatting but this method is easier.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;First select the continuous form. &lt;/li&gt;    &lt;li&gt;Set the &lt;strong&gt;Back Color&lt;/strong&gt; of all the controls in the detail section of the form to the color that you want to be displayed when the user clicks the control. In this example, I’m using &lt;strong&gt;#ADC0D9&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Set the &lt;strong&gt;Back Style&lt;/strong&gt; property of all the controls in the detail section of the form to &lt;strong&gt;Transparent&lt;/strong&gt;. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now, when you display the object in form view you will see the selected control highlighted with the color you have selected in the Back Color property of the control.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Identifythecolorofarecord_C932/BackColor_02.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BackColor_02" border="0" alt="BackColor_02" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/Identifythecolorofarecord_C932/BackColor_02_thumb.png" width="589" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;YEAH, now all your users can easily identify the current selected record and even the selected control where the cursor is. That’s all, no code, no difficult conditional format to configure.&lt;/p&gt;  &lt;p&gt;You can download a sample database that illustrates this method &lt;a href="http://cid-f83d4d33f0a1a23a.skydrive.live.com/self.aspx/Sample%20Databases/BackGround.accdb"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9904028" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>3 new articles available on MSDN</title><link>http://blogs.msdn.com/access/archive/2009/10/05/3-new-articles-available-on-msdn.aspx</link><pubDate>Mon, 05 Oct 2009 18:40:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9903283</guid><dc:creator>cdowns</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/access/comments/9903283.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9903283</wfw:commentRss><description>&lt;p&gt;MSDN writer Sal Ricciardi alerted us to the availability of 3 new articles on MSDN, two written by Luke Chung of &lt;a href="http://www.fmsinc.com/" target="_blank"&gt;FMS Inc.&lt;/a&gt;, and one co-written by Luke Chung and Dan Haught. &lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="459"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="321"&gt;&lt;strong&gt;Title&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="136"&gt;&lt;strong&gt;Author(s)&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="321"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd942824.aspx " target="_blank"&gt;Performance Tips To Speed Up Your Access 2007 Database&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="136"&gt;Luke Chung and Dan Haught&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="321"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ee358847.aspx " target="_blank"&gt;Error Handling and Debugging Tips for Access 2007, VB, and VBA&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="136"&gt;Luke Chung&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="321"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd638587.aspx " target="_blank"&gt;Tips and Techniques for Queries in Access 2007&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="136"&gt;Luke Chung&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Definitely bookmark these for future reference!&lt;/p&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9903283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category><category domain="http://blogs.msdn.com/access/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/access/archive/tags/Queries/default.aspx">Queries</category><category domain="http://blogs.msdn.com/access/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Dynamically Resize a Subform Based on the Record Count</title><link>http://blogs.msdn.com/access/archive/2009/09/30/dynamically-resize-a-subform-based-on-the-record-count.aspx</link><pubDate>Wed, 30 Sep 2009 23:53:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9901497</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/access/comments/9901497.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9901497</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today’s guest blogger is Vinny Malanga. Vinny is the CTO of &lt;a href="http://www.imisoftwareinc.com/"&gt;IMI Software, Inc.&lt;/a&gt; , which specializes in software development for the real estate and property management industries.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Many Access developers implement subforms to display data. Most often, at design time, the developer sets the subform to a specific size. In many cases this is fine, but there are some instances where it would be preferable to dynamically resize the subform at runtime, based on the number of records that it contains, up to a maximum number. Once the maximum number of records is reached, a vertical scroll bar should appear allowing the user to scroll through the rest of the records. The maximum number is arbitrary and simply used to prevent the subform from exceeding a certain height.&lt;/p&gt;  &lt;p&gt;I’ve provided a sample database that you can download &lt;a href="http://cid-f83d4d33f0a1a23a.skydrive.live.com/self.aspx/Sample%20Databases/ResizeSubForm.accdb"&gt;here&lt;/a&gt;. The database contains a table, two forms - a parent form and a subform - and a module with the resize method. &lt;/p&gt;  &lt;p&gt;In short, when the parent form loads, it calls a function on the subform which handles the resizing. It first retrieves the height of the header, footer and detail section of the subform. From there the subform is resized based on the height of the header, the height of the footer, and the height of the detail times the number of records. There are a couple of twips added to the total number to even out the border around the subform. Next, the record count of the underlying data source is retrieved. If the record count is greater than the maximum number of records you’ve defined, the ScrollBars property of the subform is set to 2 (Vertical Only), otherwise 0 or None. Lastly, in case there are any controls that exist under the subform, another function is called which repositions those controls based on the calculated height of the subform. &lt;/p&gt;  &lt;p&gt;I hope some of you find this technique useful.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9901497" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Form/default.aspx">Form</category><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item><item><title>Tracing Function Calls in VBA</title><link>http://blogs.msdn.com/access/archive/2009/09/24/tracing-function-calls-in-vba.aspx</link><pubDate>Thu, 24 Sep 2009 20:36:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9899067</guid><dc:creator>Mike Stowe</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/access/comments/9899067.aspx</comments><wfw:commentRss>http://blogs.msdn.com/access/commentrss.aspx?PostID=9899067</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Today’s guest blogger is Joel Graff. Joel is a field engineer with the &lt;a href="http://www.dot.state.il.us/"&gt;Illinois Department of Transportation (IDOT)&lt;/a&gt;. &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Often, I find when looking for the source of an error in VBA code, a function call trace which returns the path of function calls preceding the error to be invaluable. While more complete compilers provide this feature as a part of the IDE, it is, unfortunately, absent in VBA. To accommodate this, I’ve written my own function call stack classes to help me trace errors. This implementation is based on something I found online, though I have since lost the reference. I cannot give credit where credit is due, only note that the basic implementation is at least somewhat borrowed.&lt;/p&gt;  &lt;p&gt;There are two classes I use:&amp;#160; cErrStack and cErr.&lt;/p&gt;  &lt;p&gt;cErrStack – Instanced as a global object, this provides the stack for procedure names as they are called. Procedures are added / removed (pushed / popped) from the stack as they come in and go out of scope. When an error occurs, the stack then contains, in order, the procedures called up to the procedure in which the error occurred. The cErrStack object returns the procedure name in which the error occurred and the trace path of function calls preceding the error with the methods ErrorProcedure() and Trace(). For higher-level error handling (where error handling occurs at the form level or only in main procedures), the ErrorProcedure() and Trace() routines will not provide correct information. In these cases, ErrorProcedureHistory() and TraceHistory() should be used instead.&lt;/p&gt;  &lt;p&gt;cErr – Instanced at the procedure level, this object pushes the name of the procedure on the global error stack object (the cErrStack object). When the procedure terminates, the cErr object goes out of scope, triggering its Terminate() Event. This event then removes (pops) the terminating procedure’s name from the global error stack.&lt;/p&gt;  &lt;p&gt;A sample error message may look like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/TracingFunctionCallsinVBA_F405/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/TracingFunctionCallsinVBA_F405/clip_image002_thumb.jpg" width="384" height="153" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Often, when I deploy a new database that hasn’t had all the bugs worked out, I write my error handling routine to automatically open an email and paste the above information into it. That way, users can send me the relevant error information automatically. I also use line numbers to help better identify problem code, though I didn’t implement them in this example.&lt;/p&gt;  &lt;p&gt;The original implementation only allowed for trace information to be available in the procedure in which the error occurred. That is, if an error occurred in a function with no error handling, then by the time the error was passed back to the procedure which did handle it, the stack would no longer have accurate trace information. However, as one Access user pointed out to me, adding error trapping code to every function creates a lot of code bloat and isn’t really necessary. Better code practices suggest use of “high-level” error trapping – trapping in main functions or at the form level. To accommodate “high-level” error trapping, I added a second stack to the cErrStack class, which contains a “trace history”. &lt;/p&gt;  &lt;p&gt;The idea is simple: When an error occurs in a function with no handling, the error is passed up the line until it is handled. That means that once an error occurs in higher level error handling, a “history” needs to be preserved until the error is handled. The class object does this by copying the contents of the immediate stack to the history stack when a “pop” occurs, and simply reassigning the history stack to the immediate stack when a “push” occurs. Thus, when an error occurs and is passed up the line to the handling procedure (a series of “pops” occur on the immediate stack), the history stack is preserved. Once a push occurs on the immediate stack (which presumably won’t happen until after the error is handled) the history stack is destroyed and referenced to the immediate stack.&lt;/p&gt;  &lt;p&gt;Attached is a sample of how the application works. There are three scenarios. The first two (“Lefthand Error” and “Righthand Error”) are “immediate” error handling examples. The last one is a high-level error handling example.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/TracingFunctionCallsinVBA_F405/clip_image002%5B4%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://blogs.msdn.com/blogfiles/access/WindowsLiveWriter/TracingFunctionCallsinVBA_F405/clip_image002%5B4%5D_thumb.jpg" width="324" height="159" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click the icon below to download the sample classes.&lt;/p&gt; &lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-f83d4d33f0a1a23a.skydrive.live.com/embedicon.aspx/Sample%20Databases/Error%20Trapping%20Demo.accdb" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;  &lt;h6&gt;Send your Power Tips to Mike and Chris at &lt;a href="mailto:accpower@microsoft.com"&gt;accpower@microsoft.com&lt;/a&gt;.&lt;/h6&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9899067" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/access/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/access/archive/tags/Power+Tips/default.aspx">Power Tips</category></item></channel></rss>