<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Accessing external data using the IN clause</title><link>http://blogs.msdn.com/access/archive/2009/03/27/accessing-external-data-using-the-in-clause.aspx</link><description>Someone sent us a question the other day about one of my favorite dark corners in Access and we thought it might be interesting to dive into this area a little. Microsoft Access SQL supports two uses of the IN keyword. The most commonly used case is as</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Accessing external data using the IN clause</title><link>http://blogs.msdn.com/access/archive/2009/03/27/accessing-external-data-using-the-in-clause.aspx#9515558</link><pubDate>Sat, 28 Mar 2009 07:48:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9515558</guid><dc:creator>Tony Toews - Access MVP</dc:creator><description>&lt;p&gt;This is a useful technique and there is very little useful examples on this topic in the help files. &amp;nbsp;So it's very much a matter of trial and error figuring this out.&lt;/p&gt;
&lt;p&gt;I use this technique while updating backend MDB files to the latest version. &amp;nbsp; &lt;/p&gt;
&lt;p&gt;When the user selects the BE MDB, or upon startup, the FE MDB first update the backends tables, fields, indexes and relationships to the latest version using DAO collections.&lt;/p&gt;
&lt;p&gt;Then if there is any table clean up to be done or records to be inserted in a status table of some sort I then use the IN clause in an Action query.&lt;/p&gt;
&lt;p&gt;For example to create a &amp;quot;master&amp;quot; table of service techs from a text field entered on each individal service order in previous versions of my app I used the following:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;' Append records to ServiceRecords table&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strSQL = &amp;quot;INSERT INTO ServiceTech ( stServiceTech ) &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot; IN '&amp;quot; &amp;amp; strDatabasePathandName &amp;amp; &amp;quot;' &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;SELECT srServicePerson FROM ServiceRecords &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot; IN '&amp;quot; &amp;amp; strDatabasePathandName &amp;amp; &amp;quot;' &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;GROUP BY srServicePerson &amp;quot; &amp;amp; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;HAVING (srServicePerson Is Not Null);&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;CurrentDb.Execute strSQL, dbFailOnError&lt;/p&gt;
&lt;p&gt;Note that the strDatabasePathandName is just a share, path and file name or drive letter, path and file name. &amp;nbsp;No need to use [;DATABASE=...] etc.&lt;/p&gt;
&lt;p&gt;I then update the backend version number in a one field, one record table. &amp;nbsp;For example:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;strSQL = &amp;quot;SELECT zDataVersionNumber FROM zDataVersionNumberApp IN '&amp;quot; &amp;amp; strDatabasePathandName &amp;amp; &amp;nbsp;&amp;quot;';&amp;quot;&lt;/p&gt;
&lt;p&gt;is passed to an OpenRecordset statement with some further logic. &amp;nbsp;That could've been an Action query too.&lt;/p&gt;
</description></item><item><title>re: Accessing external data using the IN clause</title><link>http://blogs.msdn.com/access/archive/2009/03/27/accessing-external-data-using-the-in-clause.aspx#9523680</link><pubDate>Tue, 31 Mar 2009 22:06:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9523680</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;Very interesting! &amp;nbsp;I can see some uses here. &amp;nbsp;I'm building a data sync operation in an app that collects from multiple work PCs and creates a single coordinating database, and the environment does not warrant (allow) a client-server backend.&lt;/p&gt;
</description></item><item><title>re: Accessing external data using the IN clause</title><link>http://blogs.msdn.com/access/archive/2009/03/27/accessing-external-data-using-the-in-clause.aspx#9532861</link><pubDate>Mon, 06 Apr 2009 05:25:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9532861</guid><dc:creator>Renaud Bompuis</dc:creator><description>&lt;p&gt;Nice article.&lt;/p&gt;
&lt;p&gt;Access' ability to easily link to external datasources and manipulate them as if they were its own is really one of its greatest strengths.&lt;/p&gt;
</description></item></channel></rss>