<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8073048918328183953</id><updated>2024-11-01T03:45:07.685-05:00</updated><category term="Access"/><category term="VBA"/><category term="Access Forms"/><category term="Forms"/><category term="MS Access"/><category term="Microsoft Access"/><category term="API"/><category term="Access Queries"/><category term="Access VBA"/><category term="Microsoft"/><category term="Programming"/><category term="SQL"/><category term="database"/><category term="Access Links"/><category term="Access Tables"/><category term="Code"/><category term="Concatenate"/><category term="Databases"/><category term="Queries"/><category term="Shell"/><category term="Software Development"/><title type='text'>AccessInsider</title><subtitle type='html'>Examples and Experiments using Access and other Microsoft products</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-2680280566126114886</id><published>2012-02-05T21:32:00.002-06:00</published><updated>2012-02-07T18:55:39.786-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="Access Queries"/><category scheme="http://www.blogger.com/atom/ns#" term="Access VBA"/><title type='text'>Cascading List Boxes: Part 1</title><content type='html'>&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
This article will demonstrate how to create cascading list boxes between tables with one-to-many relationships.&amp;nbsp; The example provided here has been created by the author using Microsoft Access 2007.&amp;nbsp;&amp;nbsp;This method also modified to work with combo boxes and can easily be adapted for use with many-to-many relationships.&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
Our example will include four (4) list boxes based on geographic location: Continent, Country, State, City.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
We will begin by creating a table for each.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Tables&lt;/u&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
tblContinents - ContinentID, ContinentName&lt;/div&gt;
tblCountries - CountryID, CountryName, ContinentID&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
tblStates - StateID, StateName, CountryID&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
tblCities - CityID, CityName, StateID&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8MmpGZptLt6iuBo40MrkuGIvX8jsfe0R5xtTJTzIUTmnmrn0kYxcvPJljBmVon8NwgzWH_SRxjXcIcV4mh-iv3OU-VJy9Ifji5KpC6P0_-lu3FHmhgZ5BvtzK6_Rjj-5tjkUOPl5IA6wh/s1600/tblContinents.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gda=&quot;true&quot; height=&quot;120px&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8MmpGZptLt6iuBo40MrkuGIvX8jsfe0R5xtTJTzIUTmnmrn0kYxcvPJljBmVon8NwgzWH_SRxjXcIcV4mh-iv3OU-VJy9Ifji5KpC6P0_-lu3FHmhgZ5BvtzK6_Rjj-5tjkUOPl5IA6wh/s400/tblContinents.png&quot; width=&quot;400px&quot; /&gt; &lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtKsdQEoUl3qoRgSfvftmwUjPl76N8_oO7odFcsYwT-FNSP3g_oRbeXIQ80isfqHP2iUpbATvqHNR2XK7wN02yexiFpDd6fG6JHDct0F5bOcl5bY0pOrl87joWctj_NKYwYObQGqsavuzC/s1600/tblCountries.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gda=&quot;true&quot; height=&quot;133px&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtKsdQEoUl3qoRgSfvftmwUjPl76N8_oO7odFcsYwT-FNSP3g_oRbeXIQ80isfqHP2iUpbATvqHNR2XK7wN02yexiFpDd6fG6JHDct0F5bOcl5bY0pOrl87joWctj_NKYwYObQGqsavuzC/s400/tblCountries.png&quot; width=&quot;400px&quot; /&gt; &lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOjG8nzBRsV8Y14quxvXZbuoRgiKYagMvid77-vfrGQRZO5QpdAOJAo9pSf9UcbIRarNdt3H-XwnZSSFP2xF6X-Jd7bUtcKsxBE9l8DpOPjbk2R4z5Q6g8F0-LaXtICKhcHWPfcUx-tJV_/s1600/tblStates.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gda=&quot;true&quot; height=&quot;135px&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOjG8nzBRsV8Y14quxvXZbuoRgiKYagMvid77-vfrGQRZO5QpdAOJAo9pSf9UcbIRarNdt3H-XwnZSSFP2xF6X-Jd7bUtcKsxBE9l8DpOPjbk2R4z5Q6g8F0-LaXtICKhcHWPfcUx-tJV_/s400/tblStates.png&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;﻿&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijztu859fQAjdRO_yHlgcxfIn0nycFogorVfcQegXxwV0nQwwrp4aorK7QuJgCbQrzxcjXtymTaqbEOT6bBhoqDcoEgxvqszLYR72jByPwFU95sX7rLA8y0e0rtpmPOde3VW32YSTVXprJ/s1600/tblCities.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gda=&quot;true&quot; height=&quot;136px&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijztu859fQAjdRO_yHlgcxfIn0nycFogorVfcQegXxwV0nQwwrp4aorK7QuJgCbQrzxcjXtymTaqbEOT6bBhoqDcoEgxvqszLYR72jByPwFU95sX7rLA8y0e0rtpmPOde3VW32YSTVXprJ/s400/tblCities.png&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;strong&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Relationships&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will establish single-to-many relationships between the tables.&lt;br /&gt;
&lt;br /&gt;
Each continent may be related to many countries, each country may be related to many states, each state may be related to many cities.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxrwkLn1o4dymteuVgUfiFcTByK1y0mIXNoZvG3PoDj2UPg-MHr6bQ4O9w9fGd46bWlCC6N2ItqAbVTP49iQ8IAE4pZMsvA1LL3XfhzgYvt-ql1JoAJJ2xrlkaDSeM8TYWW41WEuJzHHSO/s1600/LocationRelationships.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; height: 100px; margin-bottom: 1em; margin-right: 1em; width: 597px;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;100px&quot; sda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxrwkLn1o4dymteuVgUfiFcTByK1y0mIXNoZvG3PoDj2UPg-MHr6bQ4O9w9fGd46bWlCC6N2ItqAbVTP49iQ8IAE4pZMsvA1LL3XfhzgYvt-ql1JoAJJ2xrlkaDSeM8TYWW41WEuJzHHSO/s400/LocationRelationships.png&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;Form Controls&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now that the table relationships are in place, it&#39;s time to add the list box controls to a form.&lt;br /&gt;
&lt;br /&gt;
We&#39;ll add one list box for each of our tables; lstContinent, lstCountry, lstState, lstCity.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;em&gt;Tip:&amp;nbsp; The column count property for each should be 2.&amp;nbsp; Column width should be 0&quot;;2&quot; in order to hide the bound ID column and show the name column.&lt;/em&gt;&lt;/blockquote&gt;
The row source of each child list box will be dependent on the parent list box(es).&amp;nbsp; While we could set the row sources of our list boxes in VBA, this example will accomplish the task by setting a query as the rowsource.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;lstContinent.RowSource&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The row source for the continent list box is pretty straight forward as it is the top level of our cascade and isn&#39;t dependent on any of the other list boxes.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblContinents.ContinentID, tblContinents.ContinentName&lt;br /&gt;FROM tblContinents&lt;br /&gt;ORDER BY tblContinents.ContinentName;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;strong&gt;&lt;u&gt;lstCountry.RowSource&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The country list box row source is dependent on the continent list box control.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblCountries.CountryID, tblCountries.CountryName, tblCountries.ContinentID&lt;br /&gt;FROM tblContinents INNER JOIN tblCountries ON tblContinents.ContinentID = tblCountries.ContinentID&lt;br /&gt;WHERE ((tblCountries.ContinentID)=[Forms]![frmLocation]![lstContinent]);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
For the remaining levels of our cascade, we must not only reference the list box directly above it, but all parent list boxes back to the top level.&amp;nbsp; This will be explained when we configure the list boxes to be updated in VBA.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;strong&gt;&lt;u&gt;lstState.RowSource&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblStates.StateID, tblStates.StateName, tblStates.CountryID, tblContinents.ContinentID&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;FROM (tblContinents INNER JOIN tblCountries ON tblContinents.ContinentID = tblCountries.ContinentID) INNER JOIN tblStates ON tblCountries.CountryID = tblStates.CountryID&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WHERE (((tblStates.CountryID)=[Forms]![frmLocation]![lstCountry]) AND ((tblContinents.ContinentID)=[Forms]![frmLocation]![lstContinent]))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ORDER BY tblStates.StateName;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;strong&gt;&lt;u&gt;lstCity.RowSource&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblCities.CityID, tblCities.CityName, tblCities.StateID, tblCountries.CountryID, tblContinents.ContinentID&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;FROM ((tblContinents INNER JOIN tblCountries ON tblContinents.ContinentID = tblCountries.ContinentID) INNER JOIN tblStates ON tblCountries.CountryID = tblStates.CountryID) INNER JOIN tblCities ON tblStates.StateID = tblCities.StateID&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WHERE (((tblCities.StateID)=[Forms]![frmLocation]![lstState]) AND ((tblCountries.CountryID)=[Forms]![frmLocation]![lstCountry]) AND ((tblContinents.ContinentID)=[Forms]![frmLocation]![lstContinent]))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ORDER BY tblCities.CityName;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the lstCity.RowSource query for those of you more comfortable building queries in design view.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_bd4GQcguSD9AuBXJ9x6F-t-DEWvgKeUYES-wDQ5CXGtBMsvCd0czuztsfnVV7hSygAP7cTC7dKPQqN4J8VmdpmjTUUzL_5TWY5Y3buYRBnzK_rajsQLJLIGg_FnjKpAHNxFwmCMCXXv1/s1600/lstCityRowSource.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;176px&quot; sda=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_bd4GQcguSD9AuBXJ9x6F-t-DEWvgKeUYES-wDQ5CXGtBMsvCd0czuztsfnVV7hSygAP7cTC7dKPQqN4J8VmdpmjTUUzL_5TWY5Y3buYRBnzK_rajsQLJLIGg_FnjKpAHNxFwmCMCXXv1/s400/lstCityRowSource.png&quot; width=&quot;400px&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;strong&gt;&lt;u&gt;Updating the Row Sources&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we&#39;ll add VBA code to our form to requery our list boxes to update the row source(s) based on the user&#39;s selection.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub lstContinent_AfterUpdate()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;&amp;nbsp;&amp;nbsp; requery child list boxes.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstCountry.Requery&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstState.Requery&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstCity.Requery&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub lstCountry_AfterUpdate()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;&amp;nbsp;&amp;nbsp; requery child list boxes.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstState.Requery&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstCity.Requery&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub lstState_AfterUpdate()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;&amp;nbsp;&amp;nbsp; requery child list boxes.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.lstCity.Requery&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the continent list box requeries all three child list boxes.&amp;nbsp; This is to ensure that all of the list boxes are updated when a new continent is selected.&amp;nbsp; Each level requeries all of it&#39;s child controls.&amp;nbsp; By including all of the parent controls as criteria&amp;nbsp;in in our row source queries (set up earlier), we ensured that only related child records are displayed when the selected parent records are updated.&lt;br /&gt;
&lt;br /&gt;
This article will be updated to include a functional example for download in the near future.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/2680280566126114886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/2680280566126114886'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/02/cascading-list-boxes.html' title='Cascading List Boxes: Part 1'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8MmpGZptLt6iuBo40MrkuGIvX8jsfe0R5xtTJTzIUTmnmrn0kYxcvPJljBmVon8NwgzWH_SRxjXcIcV4mh-iv3OU-VJy9Ifji5KpC6P0_-lu3FHmhgZ5BvtzK6_Rjj-5tjkUOPl5IA6wh/s72-c/tblContinents.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-2462157723088300020</id><published>2012-01-23T20:46:00.000-06:00</published><updated>2012-01-23T20:46:04.578-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Tables"/><title type='text'>Custom User Permissions: Part 1</title><content type='html'>When developing a full scale database application for Microsoft Access, one of the hurdles you&#39;re bound to run into sooner or later is the need for&amp;nbsp;user permissions. &amp;nbsp;Managing who can see which forms, edit which records, run which reports, etc can seem like a daunting task for developers.&amp;nbsp; This series is focused on provided the knowledge and resources necessary in preparation for developing&amp;nbsp;a user permissions management solution in your own database applications.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Introduction&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The &quot;&lt;a href=&quot;http://www.utteraccess.com/wiki/index.php/Login_Security&quot; target=&quot;_blank&quot;&gt;Creating Login Security using Access VBA&lt;/a&gt;&quot; article in the &lt;a href=&quot;http://www.utteraccess.com/wiki/index.php/Main_Page&quot; target=&quot;_blank&quot;&gt;UtterAccess Wiki&lt;/a&gt; serves as a good introduction to custom user permissions and for this series.&lt;br /&gt;
&lt;br /&gt;
The UA wiki article covers table design and&amp;nbsp;hard code methods of managing form access, record add/edit/delete permissions, and record filtering in a single-to-many/hierarchical&amp;nbsp;permissions system. &amp;nbsp;I recommend giving it a look as it lays foundations for a few of the methods discussed in this series.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Part 1&lt;/span&gt;&lt;/b&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
In the first part of our series on custom user permissions, we will begin by designing the user and permissions tables and relationships. &amp;nbsp;The example in this series will be designed to allow users to be members of multiple permissions groups giving administrators increased permissions management flexibility.&lt;br /&gt;
&lt;br /&gt;
First, create tblUsers as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggGfhu8oQlLcJfYu-IrolugGXHXS5LPXxRVPs8vRhT7uYIP-h7oLoH1POoljVOQEdy213Ph0JhxzVoPQCUEgfoiDC1PUNjvJaFmb3i2F0R1iOguzt8rhb14Xtfp-PVODx9fvp1CbyIJtmp/s1600/tblUsers.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;auto&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggGfhu8oQlLcJfYu-IrolugGXHXS5LPXxRVPs8vRhT7uYIP-h7oLoH1POoljVOQEdy213Ph0JhxzVoPQCUEgfoiDC1PUNjvJaFmb3i2F0R1iOguzt8rhb14Xtfp-PVODx9fvp1CbyIJtmp/s640/tblUsers.PNG&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Next, create tblPermissions.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOY_EabPmAyCzp_jawgeBGI-JqRN6ZwAyfcYa703fxKLJ7VjCncjb1TZHWpUlJCABvRuou0Cd4FEaII51f2i10jS6pCiwXNXIkHr0ABVRKnSmhSiULIIGijtI4NeqaFyBJcDRq6X4kqYDE/s1600/tblPermissions.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;auto&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOY_EabPmAyCzp_jawgeBGI-JqRN6ZwAyfcYa703fxKLJ7VjCncjb1TZHWpUlJCABvRuou0Cd4FEaII51f2i10jS6pCiwXNXIkHr0ABVRKnSmhSiULIIGijtI4NeqaFyBJcDRq6X4kqYDE/s640/tblPermissions.png&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now, create tblUserPermissions to serve as a junction table between tblUsers and tblPermissions. &amp;nbsp;This will allow us to establish a many-to-many relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAsh0cPrbbkanXSD-a44oua3kMw4yx7Zxc1DR6NPyuBzV9qdx5hi1M28xZ2HXgRhBP4sZ7frtMLQh2wCozESWiK5FEJDYBdae6wr4zoRtDmNXxToY5Shsb2jMtmQYgOcYvYQIWJGzNRUyf/s1600/tblUserPermissions.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;auto&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAsh0cPrbbkanXSD-a44oua3kMw4yx7Zxc1DR6NPyuBzV9qdx5hi1M28xZ2HXgRhBP4sZ7frtMLQh2wCozESWiK5FEJDYBdae6wr4zoRtDmNXxToY5Shsb2jMtmQYgOcYvYQIWJGzNRUyf/s640/tblUserPermissions.png&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Notice that both the UserID and PermissionID are set as the primary key for the junction table.&lt;br /&gt;
&lt;br /&gt;
Lastly, establish the relationships between the tables.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg3H-WEVs1J9wZ53UgCqBsULUQh4690UX9Wg-bYfFkYZEgsYI6ES48BelJMnxmODeV7jhYuXp7F65uOjB49lSqeZTCds1HNOM64UDSxpF3t30HrUu2BTWXRSuL_h73SypHnf5nkST17y2J/s1600/tblUserPermissionsRelationships.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;auto&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg3H-WEVs1J9wZ53UgCqBsULUQh4690UX9Wg-bYfFkYZEgsYI6ES48BelJMnxmODeV7jhYuXp7F65uOjB49lSqeZTCds1HNOM64UDSxpF3t30HrUu2BTWXRSuL_h73SypHnf5nkST17y2J/s640/tblUserPermissionsRelationships.png&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Part 1 Summary&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
In this post we created tables for users, permissions groups, and a junction table to allow each user to relate to multiple permissions groups and each permissions group to relate to multiple users.&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/2462157723088300020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/custom-user-permissions-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/2462157723088300020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/2462157723088300020'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/custom-user-permissions-part-1.html' title='Custom User Permissions: Part 1'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggGfhu8oQlLcJfYu-IrolugGXHXS5LPXxRVPs8vRhT7uYIP-h7oLoH1POoljVOQEdy213Ph0JhxzVoPQCUEgfoiDC1PUNjvJaFmb3i2F0R1iOguzt8rhb14Xtfp-PVODx9fvp1CbyIJtmp/s72-c/tblUsers.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-5222266525444187915</id><published>2012-01-17T23:25:00.001-06:00</published><updated>2012-01-18T10:40:33.885-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="Access VBA"/><title type='text'>Function to Close All Forms</title><content type='html'>The &lt;a href=&quot;http://www.utteraccess.com/wiki/index.php/CloseAllForms&quot; target=&quot;_blank&quot;&gt;CloseAllForms Function&lt;/a&gt;&amp;nbsp;article posted in the &lt;a href=&quot;http://www.utteraccess.com/wiki/index.php/Main_Page&quot; target=&quot;_blank&quot;&gt;UA Wiki&amp;nbsp;&lt;/a&gt;&amp;nbsp;is a handy tool to close all active forms opened with the DoCmd.Open method.&lt;br /&gt;
&lt;br /&gt;
The example code provided in the article includes optional arguments for excluding selected forms from being closed which is an added flexibility bonus.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
This function can be modified to close only the forms named in the arguments instead by altering the following line of code found in the example:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;If InStr(1, strExcluded, cDelimiter &amp;amp; Forms(intX).Name &amp;amp; cDelimiter, vbTextCompare) = 0 Then&lt;/span&gt;&lt;/blockquote&gt;
The above If statement checks for and excludes any forms named as arguments when calling the form. &amp;nbsp;To close only the forms named as arguments instead change the = 0 to &amp;lt;&amp;gt;0 as follows:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;If InStr(1, strExcluded, cDelimiter &amp;amp; Forms(intX).Name &amp;amp; cDelimiter, vbTextCompare) &amp;lt;&amp;gt; 0 Then&lt;/span&gt;&lt;/blockquote&gt;
See the &lt;a href=&quot;http://accessinsider.blogspot.com/&quot; target=&quot;_blank&quot;&gt;AccessInsider blog&lt;/a&gt; for additional tips or visit the &lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot; target=&quot;_blank&quot;&gt;examples page&lt;/a&gt; for free functional example downloads.</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/5222266525444187915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/function-to-close-all-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/5222266525444187915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/5222266525444187915'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/function-to-close-all-forms.html' title='Function to Close All Forms'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-4801749757164924776</id><published>2012-01-15T15:54:00.000-06:00</published><updated>2012-01-15T16:01:47.102-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Links"/><title type='text'>Lebans: An excellent developer&#39;s resource ...</title><content type='html'>Looking for functional examples of advanced access development techniques?&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
While he is no longer active in the Microsoft Access community, &lt;a href=&quot;http://lebans.com/products.htm&quot; target=&quot;_blank&quot;&gt;Stephen Lebans&lt;/a&gt; left a treasure trove of numerous tips and examples for aspiring Access database developers.&lt;br /&gt;
&lt;br /&gt;
For anyone interested in access development that hasn&#39;t been to his website, you should give it a look.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/4801749757164924776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/excellent-developers-resource.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4801749757164924776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4801749757164924776'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/excellent-developers-resource.html' title='Lebans: An excellent developer&#39;s resource ...'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-4136432672806416272</id><published>2012-01-13T22:53:00.000-06:00</published><updated>2012-01-13T23:01:09.018-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="Access Queries"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Referencing Access Objects in a Query or Control</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifhlJ6Rx9uMP10-pInmgroxYe5KiAi0KMyq_qI-7HBqAMwuD_AL7qsEpPy3YSxmDZqn82EdeIoHKDUtuwb6BrpEc-XwI5hQqsr0zLY6nO7XaXZOctIz5nOFWVMj1hq8d8SIlBiD_PPfUds/s1600/MSysObjects_FP.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifhlJ6Rx9uMP10-pInmgroxYe5KiAi0KMyq_qI-7HBqAMwuD_AL7qsEpPy3YSxmDZqn82EdeIoHKDUtuwb6BrpEc-XwI5hQqsr0zLY6nO7XaXZOctIz5nOFWVMj1hq8d8SIlBiD_PPfUds/s1600/MSysObjects_FP.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Referencing data in objects (tables, forms, queries, reports) is a basic skill in the Microsoft Access developer&#39;s toolkit, but what if you need to reference the objects themselves as part of a custom administrative interface (for example)?&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Answer:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
By referencing the [Name] field in the hidden Access system table &quot;MSysObjects&quot; and using the [Type] field as a filter criteria you can use Access objects such as tables, forms, queries, reports, and even modules as values in a queries, form controls, reports, etc. &amp;nbsp;This can be especially useful when developing a full scale custom MS Access database application. &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 240px;&quot;&gt;
 &lt;colgroup&gt;&lt;col span=&quot;2&quot; style=&quot;mso-width-alt: 5302; mso-width-source: userset; width: 80pt;&quot; width=&quot;100&quot;&gt;&lt;/col&gt;
 &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl66&quot; height=&quot;20&quot; style=&quot;height: 15.0pt; width: 80pt;&quot; width=&quot;100&quot;&gt;&lt;b&gt;Object
  Type&lt;/b&gt;&lt;/td&gt;
  &lt;td class=&quot;xl66&quot; style=&quot;border-left: none; width: 80pt;&quot; width=&quot;100&quot;&gt;&lt;b&gt;Type ID&lt;/b&gt;&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl67&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Tables&lt;/td&gt;
  &lt;td class=&quot;xl68&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;&lt;div style=&quot;text-align: right;&quot;&gt;
1&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl67&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Forms&lt;/td&gt;
  &lt;td class=&quot;xl68&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;&lt;div style=&quot;text-align: right;&quot;&gt;
-32768&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl67&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Queries&lt;/td&gt;
  &lt;td class=&quot;xl68&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;&lt;div style=&quot;text-align: right;&quot;&gt;
5&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl67&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Reports&lt;/td&gt;
  &lt;td class=&quot;xl68&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;&lt;div style=&quot;text-align: right;&quot;&gt;
-32764&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl67&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Modules&lt;/td&gt;
  &lt;td class=&quot;xl68&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;&lt;div style=&quot;text-align: right;&quot;&gt;
-32761&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Below is a sample query for listing Access form objects.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT MSysObjects.Name&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;FROM MSysObjects&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WHERE (((Left$([Name],1))&amp;lt;&amp;gt;&quot;~&quot;) AND ((MSysObjects.Type)=-32768))&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ORDER BY MSysObjects.Name;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This can easily be modified for each object type by change the type criteria in the query.&lt;br /&gt;
&lt;br /&gt;
A downloadable example, including queries for each object type and a demonstration of populating a list box with Access system objects, can be found on the &lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot;&gt;AccessInsider Examples Page&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/4136432672806416272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/referencing-access-objects-in-query-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4136432672806416272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4136432672806416272'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/referencing-access-objects-in-query-or.html' title='Referencing Access Objects in a Query or Control'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifhlJ6Rx9uMP10-pInmgroxYe5KiAi0KMyq_qI-7HBqAMwuD_AL7qsEpPy3YSxmDZqn82EdeIoHKDUtuwb6BrpEc-XwI5hQqsr0zLY6nO7XaXZOctIz5nOFWVMj1hq8d8SIlBiD_PPfUds/s72-c/MSysObjects_FP.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-1244415174674597312</id><published>2012-01-08T00:06:00.000-06:00</published><updated>2012-01-08T00:17:21.340-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Code"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Access"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Software Development"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><title type='text'>Guide to Closing Forms with VBA</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwC8ssiVO06_56JSkcI-3gpqDtH6eWKDVk5ZEFB6ZzvAcAd4BAv_AB-Stq0dje4k4ep5PEkBBUuFKgddi2uhX-QmR62aFOEtUU0ReUgzoYA-IwyZKeUPw1W9q6V5EC5RspXyqHOvXj6WzH/s1600/CloseFP.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwC8ssiVO06_56JSkcI-3gpqDtH6eWKDVk5ZEFB6ZzvAcAd4BAv_AB-Stq0dje4k4ep5PEkBBUuFKgddi2uhX-QmR62aFOEtUU0ReUgzoYA-IwyZKeUPw1W9q6V5EC5RspXyqHOvXj6WzH/s1600/CloseFP.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Because it may seem like a mundane task to many, it can be easy to overlook a few opportunities for improving our applications&#39; overall performance with something as simple as closing a form. &amp;nbsp;AccessInsider explores one such opportunity by providing an example for utilizing a public function call to close forms in order to reduce the amount of code required to load each time a form is launched.&lt;br /&gt;
&lt;br /&gt;
While any actual performance benefit will likely be undetectable using this particular example, it still provides an adequate demonstration of how a developer can streamline an application&#39;s code for&amp;nbsp;repetitive&amp;nbsp;procedures to optimize&amp;nbsp;performance.&lt;br /&gt;
&lt;br /&gt;
The common way closing a Microsoft Access for using VBA is by utilizing the DoCmd.Close method.&lt;br /&gt;
&lt;br /&gt;
DoCmd.Close(ObjectType, ObjectName, Save)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Parameters&lt;/b&gt;&lt;br /&gt;
&lt;table style=&quot;border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; color: black; font-family: &#39;Segoe UI&#39;, Verdana, Arial; font-size: 13px; text-align: left; width: 490px;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;vertical-align: top;&quot;&gt;&lt;th style=&quot;background-color: #e5e5e5; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; font-size: 1.077em; height: 21px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;&quot;&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/th&gt;&lt;th style=&quot;background-color: #e5e5e5; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; font-size: 1.077em; height: 21px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;&quot;&gt;&lt;strong&gt;Required/Optional&lt;/strong&gt;&lt;/th&gt;&lt;th style=&quot;background-color: #e5e5e5; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; font-size: 1.077em; height: 21px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;&quot;&gt;&lt;strong&gt;Data Type&lt;/strong&gt;&lt;/th&gt;&lt;th style=&quot;background-color: #e5e5e5; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; font-size: 1.077em; height: 21px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;&quot;&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr style=&quot;vertical-align: top;&quot;&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;em&gt;ObjectType&lt;/em&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;Optional&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;strong&gt;AcObjectType&lt;/strong&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;A&amp;nbsp;&lt;strong&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb225926(v=office.12).aspx&quot; style=&quot;color: #960bb4; text-decoration: none;&quot;&gt;AcObjectType&lt;/a&gt;&lt;/strong&gt;&amp;nbsp;constant that represents the type of object to close.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;vertical-align: top;&quot;&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;em&gt;ObjectName&lt;/em&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;Optional&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;strong&gt;Variant&lt;/strong&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;A string expression that&#39;s the valid name of an object of the type selected by the&amp;nbsp;&lt;em&gt;objecttype&lt;/em&gt;&amp;nbsp;argument.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;vertical-align: top;&quot;&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;em&gt;Save&lt;/em&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;Optional&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;&lt;strong&gt;AcCloseSave&lt;/strong&gt;&lt;/td&gt;&lt;td class=&quot;mainsection&quot; style=&quot;background-color: white; border-bottom-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: solid; border-top-width: 1px; line-height: 18px; margin-bottom: 1px; margin-left: 1px; margin-right: 1px; margin-top: 1px; padding-bottom: 9px; padding-left: 4px; padding-right: 4px; padding-top: 9px;&quot;&gt;A&amp;nbsp;&lt;strong&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb225836(v=office.12).aspx&quot; style=&quot;color: #960bb4; text-decoration: none;&quot;&gt;AcCloseSave&lt;/a&gt;&lt;/strong&gt;&amp;nbsp;constant tha specifies whether or not to save changes to the object. The default value is&lt;strong&gt;acSavePrompt&lt;/strong&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Table Source: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb226008(v=office.12).aspx&quot; target=&quot;_blank&quot;&gt;MSDN Office 2007: Access Developer&#39;s Reference&lt;/a&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub cmdClose_Click()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DoCmd.Close&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Result:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Closes the active window.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub cmdClose_Click()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DoCmd.Close , , acSaveYes&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Result:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Closes and saves active window object. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; Notice that even though we didn&#39;t include the object type or object name parameters, we still had to include commas for those parameters when using the save parameter. &amp;nbsp;This can be avoided by identifying the parameters used as demonstrated below:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub cmdClose_Click()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; DoCmd.Close Save:=acSaveYes&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tip: &lt;/b&gt;Naming the parameters in your code, as opposed to just using commas, will also make it more readable for other users/developers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Example 3: &lt;/b&gt;Close a specified form.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Private Sub cmdCloseFunction_Click()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;font-weight: bold;&quot;&gt;Tip:&lt;/b&gt;&lt;b&gt; &lt;/b&gt;Use quotation marks (&quot;&quot;) around the form name for the ObjectName parameter when closing other forms.&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;font-weight: bold;&quot;&gt;Example 4:&lt;/b&gt;&lt;b&gt; &lt;/b&gt;Closing a specified form using a public function call.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Module: modPublicFunctions&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Public Function CloseForm(FormName As String)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;// Author: &amp;nbsp; &amp;nbsp; Jonathon Carrell&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;// Purpose: &amp;nbsp; &amp;nbsp;Public function to close forms.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;// History: &amp;nbsp; &amp;nbsp;7 Jan 2012 &amp;nbsp;Function created.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&#39;// Close form.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; DoCmd.Close ObjectType:=acForm, ObjectName:=FormName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;End Function&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Form: frmCloseExample&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;Private Sub cmdCloseFunction_Click()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;&#39;// Call CloseForm function from modPublicFunctions to close this form.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp; CloseForm Me.Name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-weight: bold;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
A functional example database can be found at this link: &lt;a href=&quot;https://docs.google.com/open?id=0B4SOsuxlSdgIYjBiZjFiY2YtYzA5OC00OWU5LTk5MDMtYmVjZGVkOTUyZmVi&quot; target=&quot;_blank&quot;&gt;DoCmd.Close Method&lt;/a&gt;, or on the&lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot;&gt;AccessInsider Examples Page&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Comments have been included with the example code as to provide the readers with a better understanding of the methods used.</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/1244415174674597312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/guide-to-closing-forms-with-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/1244415174674597312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/1244415174674597312'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/guide-to-closing-forms-with-vba.html' title='Guide to Closing Forms with VBA'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwC8ssiVO06_56JSkcI-3gpqDtH6eWKDVk5ZEFB6ZzvAcAd4BAv_AB-Stq0dje4k4ep5PEkBBUuFKgddi2uhX-QmR62aFOEtUU0ReUgzoYA-IwyZKeUPw1W9q6V5EC5RspXyqHOvXj6WzH/s72-c/CloseFP.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-5495694658527289582</id><published>2012-01-07T01:22:00.000-06:00</published><updated>2012-01-11T17:46:47.870-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access"/><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Access"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Shell"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><title type='text'>Open Applications using Shell Method</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBGwEG5INgz-U344hVIlctYqlSqsUByHTC-vdMcvC2Ibzv5wZNcfZx_DxJ1RriHQxCYmO9M0N82ai3Hyxj_8Etec-CtMN48JzLLyrgDnPqiZuanlr1gKLgLXF_9w6GuU_47baANJSS4u7h/s1600/ShellFP.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBGwEG5INgz-U344hVIlctYqlSqsUByHTC-vdMcvC2Ibzv5wZNcfZx_DxJ1RriHQxCYmO9M0N82ai3Hyxj_8Etec-CtMN48JzLLyrgDnPqiZuanlr1gKLgLXF_9w6GuU_47baANJSS4u7h/s1600/ShellFP.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
In this post, we will go over one of the common methods for launching external programs from within Microsoft Access by utilizing the shell method in VBA. &amp;nbsp;A couple of other features also&amp;nbsp;demonstrated in the example found at the end of this post&amp;nbsp;are &lt;a href=&quot;http://accessinsider.blogspot.com/2012/01/setting-parentchild-windows.html&quot; target=&quot;_blank&quot;&gt;setting the external application as a child window&lt;/a&gt; within access and giving the shelled program a custom window caption by using API calls.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
To launch an application from within Access, use the following code in a function or sub:&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Shell (&quot;C:\YourProgramPath.exe&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
A functional example database can be found at this link: &lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B4SOsuxlSdgIMTVmNzk2OTEtOWMzNS00NzFkLThlZWMtYTE2MjAzYmMyNzUx&amp;amp;hl=en_US&quot; target=&quot;_blank&quot;&gt;Shell Method&lt;/a&gt;, or on the &lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot;&gt;AccessInsider Examples Page&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
Comments have been included with the example code as to provide the readers with a better understanding of the methods used.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/5495694658527289582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/open-applications-using-shell-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/5495694658527289582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/5495694658527289582'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/open-applications-using-shell-method.html' title='Open Applications using Shell Method'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBGwEG5INgz-U344hVIlctYqlSqsUByHTC-vdMcvC2Ibzv5wZNcfZx_DxJ1RriHQxCYmO9M0N82ai3Hyxj_8Etec-CtMN48JzLLyrgDnPqiZuanlr1gKLgLXF_9w6GuU_47baANJSS4u7h/s72-c/ShellFP.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-4110394992469247417</id><published>2012-01-05T23:37:00.000-06:00</published><updated>2012-01-11T09:51:51.670-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Concatenate"/><category scheme="http://www.blogger.com/atom/ns#" term="Databases"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Access"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Queries"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Concatenating Fields in an Access Query</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8UM4CIbI0yGMKaafrLIysfo7UIkM9GpwrDNNoHVMW0g3S0s0v5lA4mQnIni26zPVSC_UaTrTJwDHY889z7lwyqfKppmmlR19o2EYt9rhH37h-hfxvmq9oRO5JAXgIJZ0RcMs3k_GY3h2c/s1600/SQL_FP.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8UM4CIbI0yGMKaafrLIysfo7UIkM9GpwrDNNoHVMW0g3S0s0v5lA4mQnIni26zPVSC_UaTrTJwDHY889z7lwyqfKppmmlR19o2EYt9rhH37h-hfxvmq9oRO5JAXgIJZ0RcMs3k_GY3h2c/s1600/SQL_FP.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
For those of you that have wrestled with concatenating fields and the use of the &amp;amp; and + symbols, this post will demonstrate methods of building a SQL query to combine multiple fields.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
We will use one table for this example as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-AR5lKIb0vuGbXx4GQPZdQDCSX91glCmy4xePcNGIV5Jxs_j9Y2HSRmILKq2DwSjsSaKpE4VeJSWeCMeZsk_sRyadvadO1wiaAZ4MtZs7YFqAWoIXujsE1Oj7E8K_YjFzgkawSp6xDMY9/s1600/ConcatPersonTable.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-AR5lKIb0vuGbXx4GQPZdQDCSX91glCmy4xePcNGIV5Jxs_j9Y2HSRmILKq2DwSjsSaKpE4VeJSWeCMeZsk_sRyadvadO1wiaAZ4MtZs7YFqAWoIXujsE1Oj7E8K_YjFzgkawSp6xDMY9/s1600/ConcatPersonTable.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with a simple SQL query to combine the first and last names as PersonName.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [FName] &amp;amp; [LName] AS PersonName FROM tblPerson;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here we have selected the tblPerson primary key and the combined first and last name. &amp;nbsp;Below is the resulting record set.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF5u-Jac_Pk-LIZEHgP_WdSZYhnhSSzyjZLjoohHUVlFEy-8TWO_SpUhNwS-xwCsu9e6IbrlnReCE5_HIbuNhQAl827TafXQtncsc7HI11lOBXH9tOS01dtUqW7ctKsMHjJi13O5e3QvAa/s1600/ConcatNameQuery1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF5u-Jac_Pk-LIZEHgP_WdSZYhnhSSzyjZLjoohHUVlFEy-8TWO_SpUhNwS-xwCsu9e6IbrlnReCE5_HIbuNhQAl827TafXQtncsc7HI11lOBXH9tOS01dtUqW7ctKsMHjJi13O5e3QvAa/s1600/ConcatNameQuery1.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
While we have successfully combined the first and last name, there is no separation between them. &amp;nbsp;We will add a space between them by altering our SQL as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [FName] &amp;amp; &lt;span style=&quot;background-color: yellow;&quot;&gt;&quot; &quot; &amp;amp;&lt;/span&gt; [LName] AS PersonName&lt;br /&gt;FROM tblPerson;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This will return the person name as &quot;John Doe&quot;, but what if your project needs to return the person name as Last, First MI?&lt;br /&gt;
&lt;br /&gt;
To accomplish this we could write the query below.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [LName] &amp;amp; &quot;, &quot; &amp;amp; [FName] &amp;amp; &quot; &quot; &amp;amp; [MInitial] AS PersonName&lt;br /&gt;FROM tblPerson;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The drawback to this method is that even if no middle initial exists for a record, an unnecessary space is placed after the first name. &amp;nbsp;This may not seem all that important in this example, but we will explore this issue further momentarily. &lt;br /&gt;
&lt;br /&gt;
A better method would be as follows (assuming the first and last names are required fields):&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [LName] &amp;amp; &quot;, &quot; &amp;amp; [FName] &amp;amp; &lt;span style=&quot;background-color: yellow;&quot;&gt;&quot; &quot; + [MInitial]&lt;/span&gt; AS PersonName&lt;br /&gt;FROM tblPerson&lt;br /&gt;ORDER BY tblPerson.LName;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
By changing the &amp;amp; to a +, the space after the first name becomes dependent on there being a middle initial present for the record. It may have caught your eye that an additional line has been added to the above query; this is to order the records by last name.&lt;br /&gt;
&lt;br /&gt;
For those readers that are more comfortable with building access queries in &quot;Design View&quot;, the below image is provided as reference.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMmMmIQRfKaOKaOMN5z2Xjbe5FnoLUSPeCnFcgZgHcTRaOu-fF59pCI4XzaosveW0TqxgRJIfmXjDbC1H1PwRhFwtwhFkcTC_W6pqDT_8CdfcQTkRiK-Vv18-cN5GPhzLXRglm2C10F8N3/s1600/ConcatNameQuery2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMmMmIQRfKaOKaOMN5z2Xjbe5FnoLUSPeCnFcgZgHcTRaOu-fF59pCI4XzaosveW0TqxgRJIfmXjDbC1H1PwRhFwtwhFkcTC_W6pqDT_8CdfcQTkRiK-Vv18-cN5GPhzLXRglm2C10F8N3/s1600/ConcatNameQuery2.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s look at another example of how the + can be used in concatenated fields. Below we have added a PhoneNumbers concatenated field to our query.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [LName] &amp;amp; &quot;, &quot; &amp;amp; [FName] &amp;amp; &quot; &quot;+[MInitial] AS PersonName, &lt;span style=&quot;background-color: yellow;&quot;&gt;&quot;Home: &quot; &amp;amp; [PhoneHome] &amp;amp; &quot;/&quot; &amp;amp; &quot;Cell: &quot; &amp;amp; [PhoneCell] &amp;amp; &quot;/&quot; &amp;amp; &quot;Business: &quot; &amp;amp; [PhoneBusiness] AS PhoneNumbers&lt;/span&gt; FROM tblPerson ORDER BY tblPerson.LName; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the result:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfXlLSSB_-EWn4i1zpoLLKhMHyRrAqVlyKRaqIYU8wK47k_enCKd66rpRskYobwNvlOPIZ187jZHGKGQLg31WsTNOijm6zDfEga8IrlrNw_G-Il0wY016AYhmtZXcu38rIrYrjfTWueMTe/s1600/ConcatNameQuery3.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfXlLSSB_-EWn4i1zpoLLKhMHyRrAqVlyKRaqIYU8wK47k_enCKd66rpRskYobwNvlOPIZ187jZHGKGQLg31WsTNOijm6zDfEga8IrlrNw_G-Il0wY016AYhmtZXcu38rIrYrjfTWueMTe/s1600/ConcatNameQuery3.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
You may notice that Susie&#39;s record returned unnecessary &quot;/&quot; separators and descriptions for phone numbers she doesn&#39;t have. We will improve the query by building in some dependencies. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;SELECT tblPerson.PersonID, [LName] &amp;amp; &quot;, &quot; &amp;amp; [FName] &amp;amp; &quot; &quot;+[MInitial] AS PersonName, &quot;Home: &quot; &lt;span style=&quot;background-color: yellow;&quot;&gt;+ &lt;/span&gt;[PhoneHome] &amp;amp; &quot;/&quot; &lt;span style=&quot;background-color: yellow;&quot;&gt;+ &lt;/span&gt;&quot;Cell: &quot; &lt;span style=&quot;background-color: yellow;&quot;&gt;+ &lt;/span&gt;[PhoneCell] &amp;amp; &quot;/&quot; &lt;span style=&quot;background-color: yellow;&quot;&gt;+ &lt;/span&gt;&quot;Business: &quot; &lt;span style=&quot;background-color: yellow;&quot;&gt;+ &lt;/span&gt;[PhoneBusiness] AS PhoneNumbers FROM tblPerson ORDER BY tblPerson.LName; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the final result.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhACPkBPFpVtWCL5MkTGyTZWquKcvh7qm0Y9kHMd50t8zH6ee0UJePXalVBgRi4wOGjuCVLFcp-4HYIEe1qO0O1f4fap2hoaFAV-VlQnjlou1l62AVBHvqsHxdXjm2KsrYOsBwCqW9HYtQx/s1600/ConcatNameQuery4.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhACPkBPFpVtWCL5MkTGyTZWquKcvh7qm0Y9kHMd50t8zH6ee0UJePXalVBgRi4wOGjuCVLFcp-4HYIEe1qO0O1f4fap2hoaFAV-VlQnjlou1l62AVBHvqsHxdXjm2KsrYOsBwCqW9HYtQx/s1600/ConcatNameQuery4.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Visit &lt;a href=&quot;http://accessinsider.blogspot.com/&quot;&gt;AccessInsider &lt;/a&gt;for other Microsoft Access tutorials and examples.</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/4110394992469247417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/concatenating-fields-in-access-query.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4110394992469247417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/4110394992469247417'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/concatenating-fields-in-access-query.html' title='Concatenating Fields in an Access Query'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8UM4CIbI0yGMKaafrLIysfo7UIkM9GpwrDNNoHVMW0g3S0s0v5lA4mQnIni26zPVSC_UaTrTJwDHY889z7lwyqfKppmmlR19o2EYt9rhH37h-hfxvmq9oRO5JAXgIJZ0RcMs3k_GY3h2c/s72-c/SQL_FP.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-6787516215039659588</id><published>2012-01-05T01:26:00.000-06:00</published><updated>2012-01-10T20:18:15.447-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access"/><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><title type='text'>Setting Parent/Child Windows</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGe3jVf2KSQn967H8viW4YDMmYwp6vQS_Pd63tDQc13zYcnQg62tdLsVfTQjnKbotaU04OI16jZvvBDluJWOIgCucxEuyJG0hGVps8u-rsjRPEsYXbjUpdLL5HOGQeELD_hBU3OyMESj2c/s1600/VBA_FP.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGe3jVf2KSQn967H8viW4YDMmYwp6vQS_Pd63tDQc13zYcnQg62tdLsVfTQjnKbotaU04OI16jZvvBDluJWOIgCucxEuyJG0hGVps8u-rsjRPEsYXbjUpdLL5HOGQeELD_hBU3OyMESj2c/s1600/VBA_FP.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Here is a simple method for forcing a form window to open inside another form&#39;s window when the parent form is loaded.  This can be useful for access applications utilizing a custom user interface.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;b&gt;Note:&lt;/b&gt; The below code and provided example use two(2) forms (frmParentWindow and frmChildWindow). &amp;nbsp;You will need to reference your own form names when utilizing the provided code in your projects.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;modSetParent&lt;/b&gt;&amp;nbsp;(Module Name)&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Option Compare Database&lt;br /&gt;&lt;br /&gt;Public Const GW_HWNDNEXT = 2&lt;br /&gt;&lt;br /&gt;Public Declare Function SetParent Lib &quot;user32&quot; (ByVal hWndChild As Long, _&lt;br /&gt;&lt;br /&gt;    ByVal hWndNewParent As Long) As Long&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;To open a form window as a child of of the parent form, place the following code in the On Open event of the child form:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;br /&gt;    Dim frm As Form   &lt;br /&gt;&lt;br /&gt;    Set frm = Form_frmChildWindow&lt;br /&gt;&lt;br /&gt;&#39;// If parent form is open ...&lt;br /&gt;&lt;br /&gt;    If CurrentProject.AllForms(&quot;frmParentWindow&quot;).IsLoaded Then  &lt;br /&gt; &lt;br /&gt;&#39;// Set from as child of parent form window (call SetParent function from modSetParent).&lt;br /&gt;&lt;br /&gt;    hWndChild = frm.hWnd&lt;br /&gt;&lt;br /&gt;        Call SetParent(hWndChild, Forms!frmParentWindow.hWnd)&lt;br /&gt;&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;    frm.Visible = True&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #666666;&quot;&gt;
&lt;span style=&quot;background-color: whitesmoke; color: #3c3c3c; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: whitesmoke; color: #3c3c3c; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; text-align: justify;&quot;&gt;A functional example database can be found at this link:&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: whitesmoke; color: #c91402; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; outline-color: initial; outline-style: none; outline-width: initial; text-align: justify;&quot;&gt;&lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B4SOsuxlSdgIOTNlZDM4NzktZTQzNy00ZTgyLWE3NDAtNzBkY2FlMjkyODU1&amp;amp;hl=en_US&quot; target=&quot;_blank&quot;&gt;Setting Parent/Child Windows&lt;/a&gt;&lt;/b&gt;&lt;span style=&quot;background-color: whitesmoke; color: #3c3c3c; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; text-align: justify;&quot;&gt;, or on the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot; style=&quot;background-color: whitesmoke; color: #c91402; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; outline-color: initial; outline-style: none; outline-width: initial; text-align: justify;&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;AccessInsider Examples Page&lt;/b&gt;&lt;/a&gt;&lt;span style=&quot;background-color: whitesmoke; color: #3c3c3c; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; text-align: justify;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: whitesmoke; color: #3c3c3c; font-family: Georgia, &#39;Times New Roman Times&#39;, serif; font-size: 12px; line-height: 20px; text-align: justify;&quot;&gt;Comments have been included with the example code as to provide the readers with a better understanding of the methods used.&lt;/span&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/6787516215039659588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/setting-parentchild-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/6787516215039659588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/6787516215039659588'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/setting-parentchild-windows.html' title='Setting Parent/Child Windows'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGe3jVf2KSQn967H8viW4YDMmYwp6vQS_Pd63tDQc13zYcnQg62tdLsVfTQjnKbotaU04OI16jZvvBDluJWOIgCucxEuyJG0hGVps8u-rsjRPEsYXbjUpdLL5HOGQeELD_hBU3OyMESj2c/s72-c/VBA_FP.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8073048918328183953.post-8714264280281501004</id><published>2012-01-04T23:01:00.000-06:00</published><updated>2012-01-04T23:01:46.580-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access"/><category scheme="http://www.blogger.com/atom/ns#" term="Forms"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><title type='text'>Managing Multiple Form Instances</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Need: Multiple Form Instances&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Have you ever needed to create/compare/edit multiple records at the same time? &amp;nbsp;If so, you&#39;ve probably noticed that the default form behavior in access is to allow one instance of each form to be open at any given time. &amp;nbsp;This limits the user to working with one record at a time in &quot;Single Form&quot; view. &amp;nbsp;The good news is that there are a few different ways of adding and managing multiple instances of a form and this article will cover the method most commonly utilized for my projects.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;b&gt;Solution: Collection Method&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
This example will use two forms (frmMain and frmPersonsDetail) and three(3) modules outlined below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;modInstanceCollection&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
This module contains functions necessary for managing instances of the person form.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Function OpenNewRecordFormInstance() - Create &quot;New Record&quot; form instance.&lt;/li&gt;
&lt;li&gt;Function OpenFormInstance(Optional lngID As Long) - Create form instance.&lt;/li&gt;
&lt;li&gt;Function CloseInstanceCollection() - Close all instances in form collection&lt;/li&gt;
&lt;li&gt;Function CloseInstanceHwnd(lngHwnd As Long) As Boolean - Close specified instance based on form&#39;s window handle.&lt;/li&gt;
&lt;li&gt;Function CloseInstanceID(lngID As Long) As Boolean - Alternative method to close specified instance based on record&#39;s ID.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;b&gt;modSetParent&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This module is used to set each new instance of the person form as a child of the main form. &amp;nbsp;The purpose of demonstrating this functionality is to prevent the person forms from disappearing behind the main form when the lose focus. &amp;nbsp;Utilizing this method can be especially beneficial for applications using a form as the basis of a custom user interface.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;modInstancePosition&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This module contains functions for managing the opening position of form instances. &amp;nbsp;This is used to prevent each concurrent form instance from being opened directly on top of to previous instance.&lt;br /&gt;
&lt;br /&gt;
A functional example database can be found at this link: &lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B4SOsuxlSdgIOWMwMWU1ZWMtOGRjZi00NmVhLWE2YzUtMjYxNDk4MTk4MjYw&amp;amp;hl=en_US&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Multi-Instance Form Management&lt;/b&gt;&lt;/a&gt;, or on the &lt;a href=&quot;http://accessinsider.blogspot.com/p/access-examples.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;AccessInsider Examples Page&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Comments have been included with the example code as to provide the readers with a better understanding of the methods used.&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;
&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://accessinsider.blogspot.com/feeds/8714264280281501004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://accessinsider.blogspot.com/2012/01/managing-multiple-form-instances.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/8714264280281501004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8073048918328183953/posts/default/8714264280281501004'/><link rel='alternate' type='text/html' href='http://accessinsider.blogspot.com/2012/01/managing-multiple-form-instances.html' title='Managing Multiple Form Instances'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>