<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20829.aspx</link><pubDate>Fri, 15 Jun 2007 11:53:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20829</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20829.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20829</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m just in the process of downloading&amp;nbsp;a debugger to try and find where the problems might lie.&amp;nbsp; A bit worried about which debugger to use?&amp;nbsp; Is the CSDebugger OK?&lt;/p&gt;&lt;p&gt;Anyway - many thanks for your help so far Matt - I wouldn&amp;#39;t be this far down the road without you.&amp;nbsp; I&amp;#39;m confident I&amp;#39;ll resolve the issue - by hook or by crook!&amp;nbsp; Watch this space ...&amp;nbsp;you never know, NoCanDo might turn into TheResolver!&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20828.aspx</link><pubDate>Fri, 15 Jun 2007 11:40:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20828</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20828.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20828</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m not sure what else to tell you.&amp;nbsp; The code looks right, you probably just have a problem with the XPath.&amp;nbsp; Or maybe it is the capitialization of the XDocument.DOM - have you tried stepping through with the debugging or putting in alert statements to watch the state of your variables and method calls?&lt;/p&gt;&lt;p&gt;Sorry, the 1337 references was refering to this: &lt;a href="http://en.wikipedia.org/wiki/Leet"&gt;http://en.wikipedia.org/wiki/Leet&lt;/a&gt;&amp;nbsp;Just a little geek-humor :)&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20826.aspx</link><pubDate>Fri, 15 Jun 2007 11:29:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20826</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20826.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20826</wfw:commentRss><description>&lt;p&gt;Hi Matt&lt;/p&gt;&lt;p&gt;Really struggling with this all morning. Have implemented your script and needed to&amp;nbsp;amend to the following to get it to &amp;#39;run&amp;#39;, but it still returns &amp;#39;Object variable not set&amp;#39; relating to the line&amp;nbsp;&amp;#39;numberNode = ...&amp;#39;&lt;/p&gt;&lt;p&gt;dim numberVal&lt;br /&gt;dim numberNode&lt;/p&gt;&lt;p&gt;numberVal = -1&lt;br /&gt;numberNode = Xdocument.dom.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Available_Table/Rows/row[@Allocated = &amp;#39;OPEN&amp;#39; and @Site = &amp;#39;Fenton&amp;#39;]/@Number&amp;quot;)&lt;br /&gt;if( [numberNode = null] )then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numberVal = numberNode.text&lt;br /&gt;end if&lt;/p&gt;&lt;p&gt;The additional [] I&amp;#39;ve had to add were to get around errors reporting &amp;#39;Expected &amp;#39;)&amp;#39; not found&amp;#39;&lt;/p&gt;&lt;p&gt;Don&amp;#39;t know if I&amp;#39;m makingthings worse by doing it, but I&amp;#39;m one character at a time to resolve the issues.&lt;/p&gt;&lt;p&gt;Hope you can help more. Kind regards and many thanks for your help so&amp;nbsp;far.&amp;nbsp;One other question, what is Post 1337? and how do I find it? &lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20804.aspx</link><pubDate>Thu, 14 Jun 2007 18:49:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20804</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20804.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20804</wfw:commentRss><description>&lt;p&gt;This could be happening for a number of reasons.&amp;nbsp; My first guess is that the query is not finding anything.&amp;nbsp; You need to check if it finds something, before trying to access .text.&lt;/p&gt;&lt;p&gt;var numberVal =&amp;nbsp;-1;&amp;nbsp;&lt;br /&gt;var numberNode = Xdocument.dom.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Available_Table/Rows/row[@Allocated = &amp;#39;OPEN&amp;#39; and @Site = &amp;#39;Fenton&amp;#39;]/@Number&amp;quot;); &lt;br /&gt;if( numberNode != null ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numberVal = numberNode.text;&lt;/p&gt;&lt;p&gt;So, there might be something wrong with your query.&amp;nbsp; Note that you never need the double-slash // at the root of your query.&amp;nbsp; You&amp;#39;ll only ever have 1 root node.&lt;/p&gt;&lt;p&gt;PS - This is post 1337!!&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20763.aspx</link><pubDate>Thu, 14 Jun 2007 13:47:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20763</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20763.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20763</wfw:commentRss><description>&lt;p&gt;Hi Matt&lt;/p&gt;&lt;p&gt;Have checked out your idea, implemented a &amp;#39;query&amp;#39; in the script:&lt;/p&gt;&lt;p&gt;Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Available_Table/Rows/row[@Allocated = &amp;#39;OPEN&amp;#39; and @Site = &amp;#39;Fenton&amp;#39;]/@Number&amp;quot;).text&lt;/p&gt;&lt;p&gt;&amp;nbsp;and it returns an error:&lt;/p&gt;&lt;p&gt;Object required: &amp;#39;XDocument.DOM.selectSingleNode(...)&amp;#39;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m obvuiously doing something wrong...&lt;/p&gt;&lt;p&gt;&amp;nbsp;Please help the unititiated :-(&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20757.aspx</link><pubDate>Thu, 14 Jun 2007 13:10:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20757</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20757.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20757</wfw:commentRss><description>&lt;p&gt;Good luck!&lt;/p&gt;&lt;p&gt;To select the highest, you could either reverse-sort the list and use the same XPath, or change the XPath to this:&lt;/p&gt;&lt;p&gt;/dfs:myFields/dfs:dataFields/AvailableTable/Rows/row[ Allocated = &amp;#39;OPEN&amp;#39; and&amp;nbsp;Site = &amp;#39;Fenton&amp;#39;&amp;nbsp;][last()]/Number&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20752.aspx</link><pubDate>Thu, 14 Jun 2007 12:49:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20752</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20752.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20752</wfw:commentRss><description>&lt;p&gt;Thanks Matt&lt;/p&gt;&lt;p&gt;We knew the code was &amp;#39;overdone&amp;#39; but couldn&amp;#39;t make it work any other way to select the highest number.&lt;/p&gt;&lt;p&gt;Will check out your idea and get back if there&amp;#39;s an issue. &lt;/p&gt;&lt;p&gt;Many thanks - The NoCanDoer!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20749.aspx</link><pubDate>Thu, 14 Jun 2007 11:29:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20749</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20749.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20749</wfw:commentRss><description>&lt;p&gt;Hi again,&lt;/p&gt;&lt;p&gt;I do believe you have incredibly over-complicated things. :)&lt;/p&gt;&lt;p&gt;If you have all of these rows in a secondary data source, then you can use a simple XPath query to get the number you are looking for.&amp;nbsp; Try this:&lt;/p&gt;&lt;p&gt;/dfs:myFields/dfs:dataFields/AvailableTable/Rows/row[ Allocated = &amp;#39;OPEN&amp;#39; and&amp;nbsp;Site = &amp;#39;Fenton&amp;#39;&amp;nbsp;]/Number&lt;/p&gt;&lt;p&gt;Of course, you will have to edit this XPath to be syntactically correct with your schema, but hopefully you get the idea.&amp;nbsp; You can also replace &amp;#39;Fenton&amp;#39; with a lookup to another node to make the query more dynamic.&amp;nbsp; This query assumes that the rows are in order, but you could add more complicated conditions using the previous-sibling axis to find the largest number in the list even if it wasn&amp;#39;t sorted.&amp;nbsp; However, this&amp;nbsp;would be slower.&lt;/p&gt;&lt;p&gt;Hope this helps!&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20748.aspx</link><pubDate>Thu, 14 Jun 2007 11:14:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20748</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20748.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20748</wfw:commentRss><description>&lt;p&gt;Hi Matt&lt;/p&gt;&lt;p&gt;Many thanks for the reply, I was beginning to think there was no-one out there!&lt;/p&gt;&lt;p&gt;What I&amp;#39;m trying to do is:&lt;/p&gt;&lt;p&gt;On the InfoPath form I have a button which has a script behind it which selects its Main connection namespace, variables and strings,&amp;nbsp; etc and then runs a VBScript part of which is if a condition =yes then use SQL to select all the records from the Available table in the Non-Standard database.&amp;nbsp; The process loops until the end of file (EOF) and will then select the item in the Number field of the Available table.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Part of &amp;#39;Available&amp;#39; Table&lt;br /&gt;Number&amp;nbsp;Site&amp;nbsp;Allocated&lt;br /&gt;300422&amp;nbsp;Fenton&amp;nbsp;ALLOCATED&lt;br /&gt;300423&amp;nbsp;Fenton&amp;nbsp;ALLOCATED&lt;br /&gt;300424&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;br /&gt;300425&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;br /&gt;300426&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;br /&gt;300427&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;br /&gt;300428&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;br /&gt;300429&amp;nbsp;Fenton&amp;nbsp;OPEN&lt;/p&gt;&lt;p&gt;When the script runs, it will select the last recordset in the table according to &amp;#39;Allocated&amp;#39;= &amp;#39;OPEN&amp;#39; and (in this case) &amp;#39;Site&amp;#39;=strSITE=Fenton and will return the value in the &amp;#39;Number&amp;#39; field which would be 300429 and this number would&amp;nbsp; then be used to populate other tables.&amp;nbsp; Following allocation of this number the &amp;#39;Allocated&amp;#39; field associated with 300429 will be updated to &amp;#39;ALLOCATED&amp;#39;.&amp;nbsp; The next time the script is run under the same conditions, it will select 300428, then 300427 etc.&lt;/p&gt;&lt;p&gt;What I want the scipt to do is select 300424, then 300425 etc in an ascending order, not a descending order.&lt;/p&gt;&lt;p&gt;If strNONSTD = &amp;quot;Yes&amp;quot; then&lt;br /&gt;&amp;nbsp;&amp;#39; use SQL to select information from Available table in Non-Standard.mdb&lt;br /&gt;&amp;nbsp;sql = &amp;quot;select * from Available&amp;quot;&amp;nbsp;&amp;nbsp;&amp;#39;select all fields in Available&lt;br /&gt;&amp;nbsp;set rs = db.Execute(sql)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;do the SQL command&lt;br /&gt;&amp;nbsp;&amp;#39; read resulting record set&lt;br /&gt;&amp;nbsp;do until rs.EOF&lt;br /&gt;&amp;nbsp;&amp;nbsp;if rs(&amp;quot;Allocated&amp;quot;) = &amp;quot;OPEN&amp;quot; and rs(&amp;quot;Site&amp;quot;) = strSITE then &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strNEWNUM = rs(&amp;quot;Number&amp;quot;) &lt;br /&gt;&amp;nbsp;&amp;nbsp;end if&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if rs(&amp;quot;Allocated&amp;quot;) = strSITE then &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;strEXISTS = rs(&amp;quot;Number&amp;quot;) &lt;br /&gt;&amp;nbsp;&amp;nbsp;end if&lt;br /&gt;&amp;nbsp;&amp;nbsp;rs.MoveNext&lt;br /&gt;&amp;nbsp;loop&lt;/p&gt;&lt;p&gt;Hope this all makes sense, as it&amp;#39;s driving me a little crazy.&amp;nbsp; If you need any more info, I&amp;#39;ll be only too pleased to supply.&amp;nbsp; Good luck.&lt;/p&gt;</description></item><item><title>Re: Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20738.aspx</link><pubDate>Thu, 14 Jun 2007 09:05:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20738</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20738.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20738</wfw:commentRss><description>&lt;p&gt;Hi NoCanDo, and welcome to the forums!&lt;/p&gt;&lt;p&gt;This code looks much too complicated to simply be choosing the largest number in a list of numbers, to do that, it should simply be a loop through all the numbers using &amp;quot;CurMax = Max( CurMax, CurCompareTo )&amp;quot;. Could you explain in more detail what your code is doing? Also, we will need an idea of the schema and how things are related.&amp;nbsp; When pasting large amounts of code, it is a good idea to use a monotype font with less whitespace between lines so it is easier to read.&lt;/p&gt;</description></item><item><title>Selecting lowest number from secondary data source - InfoPath2003</title><link>https://www.infopathdev.com:443/forums/thread/20499.aspx</link><pubDate>Thu, 07 Jun 2007 11:07:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20499</guid><dc:creator>NoCanDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20499.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=20499</wfw:commentRss><description>&lt;p&gt;Hi I&amp;#39;m new to blogs/forums and InfoPath!&amp;nbsp; I&amp;#39;m struggling with what is probably a very simple piece of vbscript on a button on an InfoPath form&amp;nbsp;which selects a number from a seconday data source (Access database table).&amp;nbsp; The number it selects is the highest number in those which could be chosen, I need it to be the lowest!&amp;nbsp; If you could help I would most grateful.&amp;nbsp; The exsiting vbscript code is below, with the area where I believe the problem to be is now BOLD.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Sub CTRL401_4_OnClick(eventObj)&lt;/p&gt;&lt;p&gt;&amp;#39;&amp;nbsp;Code for &amp;#39;Start Number Allocation Process&amp;#39;&lt;/p&gt;&lt;p&gt;&amp;#39;VARIABLES&lt;/p&gt;&lt;p&gt;&amp;#39;SITEID used to differentiate between sites without naming issues&lt;/p&gt;&lt;p&gt;Dim strSITE&lt;/p&gt;&lt;p&gt;Dim strSITEID&lt;/p&gt;&lt;p&gt;Dim strNEWNUM&lt;/p&gt;&lt;p&gt;Dim strNAME&lt;/p&gt;&lt;p&gt;Dim strEXISTS&lt;/p&gt;&lt;p&gt;Dim strNONSTD&lt;/p&gt;&lt;p&gt;&amp;#39;Dim strALERT&lt;/p&gt;&lt;p&gt;strEXISTS=1&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39;INFOPATH READ INFO from Non-Standard table&lt;/p&gt;&lt;p&gt;strSITE = Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Non-Standard_Table/@SiteName&amp;quot;).text&lt;/p&gt;&lt;p&gt;strSITEID = Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Non-Standard_Table/@SiteID&amp;quot;).text &lt;/p&gt;&lt;p&gt;strNAME = Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Non-Standard_Table/@GeneralName&amp;quot;).text&lt;/p&gt;&lt;p&gt;strNONSTD = Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Non-Standard_Table/@NonStdReq&amp;quot;).text&lt;/p&gt;&lt;p&gt;&amp;#39;strALERT = XDocument.UI.Alert(&amp;quot;Numbers for IPT equipment cannot be allocated from the Non-Standard range. Please use the correct form.&amp;quot;)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39; open database&lt;/p&gt;&lt;p&gt;set db = CreateObject(&amp;quot;ADODB.Connection&amp;quot;)&lt;/p&gt;&lt;p&gt;db.Open(&amp;quot;Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\PaDa\InfoPath Test Area\Databases\Non-Standard.mdb&amp;quot;)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39;Non-Standard required?&lt;/p&gt;&lt;p&gt;If strNONSTD = &amp;quot;Yes&amp;quot; then&lt;/p&gt;&lt;p&gt;&amp;#39; use SQL to select information from Available table in Non-Standard.mdb&lt;/p&gt;&lt;p&gt;sql = &amp;quot;select * from Available&amp;quot;&lt;/p&gt;&lt;p&gt;set rs = db.Execute(sql)&lt;/p&gt;&lt;p&gt;&amp;#39; read resulting record set&lt;/p&gt;&lt;p&gt;&lt;strong&gt;do until rs.EOF&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;if rs(&amp;quot;Allocated&amp;quot;) = &amp;quot;OPEN&amp;quot; and rs(&amp;quot;Site&amp;quot;) = strSITE then &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;strNEWNUM = rs(&amp;quot;Number&amp;quot;) &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;end if&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;if rs(&amp;quot;Allocated&amp;quot;) = strSITE then &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;strEXISTS = rs(&amp;quot;Number&amp;quot;) &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;end if&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;rs.MoveNext&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;loop&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39;Set Existing Number Reservation&lt;/p&gt;&lt;p&gt;if strEXISTS &amp;lt;&amp;gt; 1 then&lt;/p&gt;&lt;p&gt;strNEWNUM = strEXISTS&amp;nbsp; &amp;#39;e.g. If strEXISTS is changed from 1 to 10 strNEWNUM will be 10&lt;/p&gt;&lt;p&gt;end if&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39; use SQL to insert new data into Available table in Non-Standard.mdb&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;sql = &amp;quot;UPDATE Available SET Allocated = (&amp;#39;&amp;quot;&amp;amp; strNAME &amp;amp; &amp;quot;&amp;#39;) WHERE Number = (&amp;#39;&amp;quot;&amp;amp; strNEWNUM &amp;amp; &amp;quot;&amp;#39;)&amp;quot;&lt;/p&gt;&lt;p&gt;set rs = db.Execute(sql)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;#39;WRITE TO INFOPATH&lt;/p&gt;&lt;p&gt;Xdocument.dom.selectSingleNode(&amp;quot;//dfs:myFields/dfs:dataFields/d:Non-Standard_Table/@AllocatedNumber&amp;quot;).text=strNEWNUM&lt;/p&gt;&lt;p&gt;end if&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;End Sub&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>