<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/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>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: creating an Access query based on main data source</title><link>https://www.infopathdev.com:443/forums/thread/20952.aspx</link><pubDate>Tue, 19 Jun 2007 17:56:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20952</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20952.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20952</wfw:commentRss><description>Sorry for the misunderstanding and bravo on figuring it all out! Thanks for posting your solution for everyone else!</description></item><item><title>Re: creating an Access query based on main data source</title><link>https://www.infopathdev.com:443/forums/thread/20947.aspx</link><pubDate>Tue, 19 Jun 2007 15:50:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20947</guid><dc:creator>michayos</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20947.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20947</wfw:commentRss><description>&lt;p&gt;Matt,&lt;/p&gt;&lt;p&gt;&amp;nbsp;Thanks for the advice.&amp;nbsp; That might work if I were using a secondary data souce but I&amp;#39;m working with the primary data source.&lt;/p&gt;&lt;p&gt;For all those like me who searched through posting after posting throughout the many sources here&amp;#39;s what worked...&lt;/p&gt;&lt;p&gt;After getting some pointers from our web developer on how to debug my code I came up with the following...&lt;/p&gt;&lt;p&gt;&amp;nbsp;function modQuery::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;// Retrieve the field in the InfoPath form whose value will be used in the &lt;br /&gt;&amp;nbsp;//WHERE clause &lt;br /&gt;&amp;nbsp;var node = XDocument.DOM.selectSingleNode(&amp;quot;/dfs:myFields/my:trueText&amp;quot;).text;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Retrieve and store the SQL statement of the main data source &lt;br /&gt;&amp;nbsp;var strSQL = XDocument.QueryAdapter.Command; &lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Generate the new SQL statement with WHERE clause &lt;br /&gt;&amp;nbsp;// Populate the command with the new SQL statement &lt;br /&gt;&amp;nbsp;XDocument.QueryAdapter.Command = strSQL + &amp;quot; where [praxaResponseOpen] = &amp;quot; + node; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;//Run the query &lt;br /&gt;&amp;nbsp;XDocument.Query();&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;//Reset SQL Query statement to origonal string of the main data source&lt;br /&gt;&amp;nbsp;XDocument.QueryAdapter.Command = strSQL&lt;br /&gt;}&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;ve fully tested this and it works perfectly.&amp;nbsp; I later realized this could also be done with a set of rules....&lt;/p&gt;&lt;p&gt;1) Set a fields value: @praxaResponseOpen (from the query fields) = trueText (trueText=&amp;quot;True&amp;quot; which is its default value)&lt;/p&gt;&lt;p&gt;2) Query using a data connection: (select your main data source connection)&lt;/p&gt;&lt;p&gt;This returned all records with my selected field set to the value I was looking for.&amp;nbsp; What can I say...I&amp;#39;m an old school programmer who likes to see whats going on so I&amp;#39;m not used to thinking in a gui environment.&amp;nbsp; This was just too easy to even occur to me.&lt;/p&gt;&lt;p&gt;Since I&amp;#39;m using this as a check to clear any flags (boolean variables) that may still be set in the database I went on with the following rules...&lt;/p&gt;&lt;p&gt;3) Set a fields value: @praxaResponseOpen (from the data fields) = falseText&lt;/p&gt;&lt;p&gt;(falseText=&amp;quot;False&amp;quot; by default so this field is set to false in all records returned by the query)&lt;/p&gt;&lt;p&gt;4) Submit using a data connection: (select your main data source)&lt;/p&gt;&lt;p&gt;5) Set a fields valus: @praxaResponseOpen (from the query fields) = &amp;quot;&amp;quot;&amp;nbsp;(clear the query field set earlier)&lt;/p&gt;&lt;p&gt;&amp;nbsp;Maybe this will prevent the next person from spending a week tracking down a resolution for a similar problem...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: creating an Access query based on main data source</title><link>https://www.infopathdev.com:443/forums/thread/20925.aspx</link><pubDate>Tue, 19 Jun 2007 08:57:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20925</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20925.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20925</wfw:commentRss><description>&lt;p&gt;Hi Michael and welcome to the forums!&lt;/p&gt;&lt;p&gt;You are very close! The line where you are getting the error should look more like this:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;var strSQL = XDocument.DataObjects[&amp;quot;NameOfSecondaryDataConnection&amp;quot;].Command;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;You might also want to check out this blog post which discusses doing the same thing in a slightly easier fashion: &lt;a href="http://www.infopathdev.com/blogs/matt/archive/2006/01/09/Create-a-Multi_2D00_View-Master_2F00_Detail-using-a-Query-Filter.aspx"&gt;http://www.infopathdev.com/blogs/matt/archive/2006/01/09/Create-a-Multi_2D00_View-Master_2F00_Detail-using-a-Query-Filter.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>creating an Access query based on main data source</title><link>https://www.infopathdev.com:443/forums/thread/20891.aspx</link><pubDate>Mon, 18 Jun 2007 17:32:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20891</guid><dc:creator>michayos</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20891.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20891</wfw:commentRss><description>&lt;p&gt;Hi guys!&lt;/p&gt;&lt;p&gt;&amp;nbsp;Ok, well I&amp;#39;ve had some java/VB programming experience a number of years ago, but I&amp;#39;m totally lost on what I&amp;#39;m missing here.&amp;nbsp; Can someone please help!?&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;ve got an Access 2003 DB on a shared network drive and an Infopath 2003 form published to a document library in windows Sharepoint Services 2.0.&lt;/p&gt;&lt;p&gt;The main form has 3 buttons that will open related forms that use the same Access DB as the primary data source so that I can populate fields in the 3 additional forms based on entries in the primary form I&amp;#39;m referencing in this post.&amp;nbsp; My goal is to use yes/no fields in the database to flag the record I want to grab data from to populate the other forms as the user clicks the button in the main form that opens them.&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;ve created the form using the Access DB as the primary datasource but also have additional fields in the Infopath form that are not part of the Access DB.&amp;nbsp; The connection name in Infopath is &amp;quot;New_User_Request_DB&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;m trying to create a connection/query statement in the form of a &amp;quot;select...from...where....&amp;quot; statement.&amp;nbsp; The default data connection to the Access DB works fine because I can use the default &amp;quot;query&amp;quot;, &amp;quot;submit&amp;quot;, etc...buttons generated by the creation of the form from the DB.&amp;nbsp; My goal here is to do a check on the yes/no field to verify all existing records have the flag cleared before I set the flag on the record of interest.&amp;nbsp; But I can&amp;#39;t get the initial query to work!&amp;nbsp; (ARGH!!!)&amp;nbsp; I&amp;#39;m sure if someone can show me where I&amp;#39;ve gone wrong, I can figure the rest out on my own (I hope!)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;I get the following error for line &amp;quot;&amp;nbsp;var strSQL = XDocument.DataObjects.QueryAdapter.Command;&amp;quot;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;#39;&amp;nbsp;XDocument.DataObjects.QueryAdapter.Command&amp;#39; is null or not an object&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;nbsp;Here&amp;#39;s my code so far...&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;function modQuery::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;// Retrieve the field in the InfoPath form whose value will be used in the &lt;br /&gt;&amp;nbsp;//WHERE clause &lt;br /&gt;&amp;nbsp;var node = XDocument.DOM.selectSingleNode(&amp;quot;/dfs:myFields/my:trueText&amp;quot;).text;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Retrieve the SQL statement of the data source &lt;br /&gt;&amp;nbsp;var strSQL = XDocument.DataObjects.QueryAdapter.Command;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Generate the new SQL statement with WHERE clause &lt;br /&gt;&amp;nbsp;strSQL += &amp;quot; where [praxaResponseOpen] = &amp;#39;&amp;quot; + node + &amp;quot;&amp;#39;&amp;quot;;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Populate the command with the new SQL statement &lt;br /&gt;&amp;nbsp;XDocument.DataObjects.QueryAdapter.Command = strSQL;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Run the query &lt;br /&gt;&amp;nbsp;XDocument.DataObjects.Query(); &lt;br /&gt;&amp;nbsp;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;nbsp;I&amp;#39;m not a programmer but I think I&amp;#39;m close....what did I miss?&amp;nbsp; Anyone please????&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Michael&lt;/p&gt;</description></item></channel></rss>