Set Value depending on View - InfoPath Dev Sign in | Join | Help in General 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 » General » Set Value depending on View Set Value depending on View Last post 12-22-2005 02:37 PM by jeanpaul. 4 replies. Page 1 of 1 (5 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 12-22-2005 08:32 AM jeanpaul Joined on 07-28-2005 Posts 10 Set Value depending on View Reply Contact I would like to set a value of a field depending on the current view..Example:if current view = "ABC"Then [field] = 5 12-22-2005 01:43 PM In reply to vt_asparagus Joined on 08-05-2005 USA Posts 285 Re: Set Value depending on View Mark as Not AnswerMark as Answer... Reply Contact Use the OnSwitchView event.Then you can do the code below in the event.if (XDocument.View.Name == "XXX"){ //do something} Jasonhttp://www.k2distillery.com/ 12-22-2005 02:06 PM In reply to jeanpaul Joined on 07-28-2005 Posts 10 Re: Set Value depending on View Mark as Not AnswerMark as Answer... Reply Contact OK i did the following on switch view: If thisXDocument.View.Name = "SUFFOLK" Then thisXDocument.DOM.selectSingleNode("//mstns:LisPendants/mstns:lisPendantslist/mstns:VIEW").text = "SUFFOLK" End IfBUT I am getting the following error:System.NullReferenceExceptionObject reference not set to an instance of an object. at LisPendants.LisPendants.OnSwitchView(DocEvent e) in S:\INFOPATH FORMS\LisPendants\FormCode.vb:line 61 at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSwitchView(DocEvent pEvent) 12-22-2005 02:23 PM In reply to jeanpaul Joined on 07-28-2005 Posts 10 Re: Set Value depending on View Mark as Not AnswerMark as Answer... Reply Contact One more thing...the node is in a repeating element 12-22-2005 02:37 PM In reply to jeanpaul Joined on 07-28-2005 Posts 10 Re: Set Value depending on View Mark as Not AnswerMark as Answer... Reply Contact Sorry it is working know...I just had the node value spelled wrong Page 1 of 1 (5 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.