<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Beancounters' guide to technology &#187; Access</title>
	<atom:link href="http://beancountersguide.co.uk/category/office-software/access/feed/" rel="self" type="application/rss+xml" />
	<link>http://beancountersguide.co.uk</link>
	<description>Helping accountants and fellow professionals turn the IT millstone into a surfboard</description>
	<lastBuildDate>Fri, 18 May 2012 07:17:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='beancountersguide.co.uk' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Beancounters' guide to technology &#187; Access</title>
		<link>http://beancountersguide.co.uk</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://beancountersguide.co.uk/osd.xml" title="Beancounters&#039; guide to technology" />
	<atom:link rel='hub' href='http://beancountersguide.co.uk/?pushpress=hub'/>
		<item>
		<title>Mapping database address fields</title>
		<link>http://beancountersguide.co.uk/2007/03/13/mapping-database-address-fields/</link>
		<comments>http://beancountersguide.co.uk/2007/03/13/mapping-database-address-fields/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 12:22:29 +0000</pubDate>
		<dc:creator>simontkb</dc:creator>
				<category><![CDATA[Access]]></category>
		<category><![CDATA[Office software]]></category>

		<guid isPermaLink="false">http://beancountersguide.co.uk/2007/03/13/mapping-database-address-fields/</guid>
		<description><![CDATA[Introduction This item arose from an engagement letter project I was working on, but should be useful whenever you are trying to translate one set of addresses, or indeed any other, fields to another. A typical situation would be the &#8230; <a href="http://beancountersguide.co.uk/2007/03/13/mapping-database-address-fields/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beancountersguide.co.uk&#038;blog=857694&#038;post=18&#038;subd=kitss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p class="MsoNormal">This item arose from an engagement letter project I was working on, but should be useful whenever you are trying to translate one set of addresses, or indeed any other, fields to another.</p>
<p class="MsoNormal">A typical situation would be the need to take the addresses from a database that refers to them as follows:</p>
<p class="MsoNormal">Address1<br />
Address2<br />
Address3<br />
Town<br />
County<br />
Postcode<br />
Country</p>
<p class="MsoNormal">and import or link them to our database which has a differently structured set of address fields:</p>
<p class="MsoNormal">Premises<br />
Town<br />
County<br />
Postcode<br />
Country</p>
<p class="MsoNormal">Obviously, if our original set of fields has no structure, we then just have to guess which fields are mapped to which other fields. The issue we want to deal with here is condensing the three individual address line fields into the one premises field.</p>
<p class="MsoNormal">Let&#8217;s look at this in stages:</p>
<h3>Stage one: concatenation</h3>
<p class="MsoNormal">First of all we will look at a section of an &#8216;Append&#8217; query that will take our 3 original address1-3 fields and join them together, with commas as separators. The append query will then add this combined address field to the &#8216;Premises&#8217; field in our current database:</p>
<p class="MsoNormal"><img src="///C:/DOCUME%7E1/Simon/LOCALS%7E1/Temp/moz-screenshot-1.jpg" /><a href="http://kitss.files.wordpress.com/2007/03/access-map-address-1.jpg" title="Concatenation"><img src="http://kitss.files.wordpress.com/2007/03/access-map-address-1.jpg?w=500" alt="Concatenation" /></a></p>
<p class="MsoNormal"><!--[if gte vml 1]&amp;gt;                                                  --><!--[if !vml]--><img src="///C:/DOCUME%7E1/Simon/LOCALS%7E1/Temp/moz-screenshot.jpg" /><!--[endif]--></p>
<p class="MsoNormal">Note that we have included a comma followed by a space between each address line, and used the &#8216;&amp;&#8217; to join all the bits of the address together.</p>
<p class="MsoNormal">This is all very well, but of course our premises address will look something like:</p>
<p class="MsoNormal"><!--[if gte vml 1]&amp;gt;   --><!--[if !vml]--><a href="http://kitss.files.wordpress.com/2007/03/access-map-address-2.jpg" title="Concatenation result"><img src="http://kitss.files.wordpress.com/2007/03/access-map-address-2.jpg?w=500" alt="Concatenation result" /></a><!--[endif]--></p>
<p class="MsoNormal">This will make it pretty tricky to generate an address in a letter or on a label.</p>
<h3>Stage two: carriage return and line feed</h3>
<p class="MsoNormal">What we really need to do is to put each of the individual fields onto a different line. We can do this by replacing the &#8220;, &#8221; bits with the characters that will create the required line feed. These are characters 13 and 10 and we need to enter them using the CHR() function as follows:</p>
<p class="MsoNormal">Chr(13) &amp; Chr(10)</p>
<p class="MsoNormal">Here is the complete field:</p>
<p class="MsoNormal"><!--[if gte vml 1]&amp;gt;   --><!--[if !vml]--><a href="http://kitss.files.wordpress.com/2007/03/access-map-address-3.jpg" title="Separate lines"><img src="http://kitss.files.wordpress.com/2007/03/access-map-address-3.jpg?w=500" alt="Separate lines" /></a><!--[endif]--></p>
<p class="MsoNormal">and the result:</p>
<p class="MsoNormal"><!--[if gte vml 1]&amp;gt;   --><!--[if !vml]--><a href="http://kitss.files.wordpress.com/2007/03/access-map-address-4.jpg" title="Separate lines result"><img src="http://kitss.files.wordpress.com/2007/03/access-map-address-4.jpg?w=500" alt="Separate lines result" /></a><!--[endif]--></p>
<h3>Stage 3: allow for empty fields</h3>
<p class="MsoNormal">We&#8217;re not quite there yet. If any of the address fields are blank, we will end up with blank lines in our new premises field. We need to use the Access IIF() function to check each field and only include it if it has something in it.</p>
<p class="MsoNormal">In fact it&#8217;s worse than that because if there is something in address2 but not in address1, we need to include the contents of address2, but not the carriage return/line feed that precedes it. The same issue occurs if there is something in address3, but nothing in either address1 or address2.</p>
<p class="MsoNormal">We think the following should do the trick – please let us know if you don&#8217;t think it will work properly, or if you are able to come up with a more elegant solution:</p>
<p class="MsoNormal"><a title="OLE_LINK2" name="OLE_LINK2"></a><a title="OLE_LINK1" name="OLE_LINK1"></a><span>Premises: [address1] &amp; IIf([address2]&lt;&gt;&#8221;",IIf([address1]&lt;&gt;&#8221;",Chr(13) &amp; Chr(10)) &amp; [address2]) &amp; IIf([address3]&lt;&gt;&#8221;",IIf([address1] &amp; [address2]&lt;&gt;&#8221;",Chr(13) &amp; Chr(10)) &amp; [address3])</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kitss.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kitss.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kitss.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kitss.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kitss.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beancountersguide.co.uk&#038;blog=857694&#038;post=18&#038;subd=kitss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beancountersguide.co.uk/2007/03/13/mapping-database-address-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6ff87efe8f5580fa5c270669d0f998d8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simontkb</media:title>
		</media:content>

		<media:content url="http://kitss.files.wordpress.com/2007/03/access-map-address-1.jpg" medium="image">
			<media:title type="html">Concatenation</media:title>
		</media:content>

		<media:content url="http://kitss.files.wordpress.com/2007/03/access-map-address-2.jpg" medium="image">
			<media:title type="html">Concatenation result</media:title>
		</media:content>

		<media:content url="http://kitss.files.wordpress.com/2007/03/access-map-address-3.jpg" medium="image">
			<media:title type="html">Separate lines</media:title>
		</media:content>

		<media:content url="http://kitss.files.wordpress.com/2007/03/access-map-address-4.jpg" medium="image">
			<media:title type="html">Separate lines result</media:title>
		</media:content>
	</item>
	</channel>
</rss>
