VBscript error for script on OnAfterChange Event - InfoPath Dev Sign in | Join | Help in Code InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Code » VBscript error for script on OnAfterChange Event VBscript error for script on OnAfterChange Event Last post 01-27-2006 09:50 AM by cmenconi. 2 replies. Page 1 of 1 (3 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 01-27-2006 08:33 AM cmenconi Joined on 01-18-2006 Posts 2 VBscript error for script on OnAfterChange Event Reply Contact I am having an issue with a vbscript set to run as a Data Validation script triggered by an OnAfterChange event. The Error I get is An error occurred in the form's code. The number of calls to the OnAfterChange event for a single update in the data exceeded the maximum limit.I have found a few articals on this error but all of them pointed to jscript which I am unfamiliar with.Sub msoxd_my_txtServerName_OnAfterChange(eventObj)' Write code here to restore the global state.If eventObj.IsUndoRedo Then ' An undo or redo operation has occurred and the DOM is read-only. Exit SubEnd If' A field change has occurred and the DOM is writable. Write code here to respond to the changes.Dim objServerNameSet objServerName = XDocument.DOM.selectSingleNode("//my:myFields/my:txtServerName")objServerName.text = ucase(objServerName.text)End SubAny help would be much apperciated... Thanks! 01-27-2006 09:24 AM In reply to Matt Faus Joined on 08-18-2006 Dallas, Texas Posts 1,558 Re: VBscript error for script on OnAfterChange Event Mark as Not AnswerMark as Answer... Reply Contact This code is causing an infinite loop. When you use "objServerName.text = ucase(objServerName.text)" it calls the OnAfterChange event of that node (which is itself) and causes recursion.Greg Collins has written a HowTo on this issue, it can be found here:http://infopathdev.com/howto/tips/default.aspx?i=3551199a23ac41f3a155b3a2ffc412c5You will use a boolean variable to indicate whether it is the code changing the value of the field or the user.---------------Matt FausInfoPath Dev Texas Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge 01-27-2006 09:50 AM In reply to cmenconi Joined on 01-18-2006 Posts 2 Re: VBscript error for script on OnAfterChange Event Mark as Not AnswerMark as Answer... Reply Contact MattThanks for the pointer, I had read this artical prevously but Unfortunitly all of greg's examples are in jscript and I am working in vbscript and am having troubles adapting the concepts between the two Page 1 of 1 (3 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.