Below is a description of my problem, keep in mind i am using infopath 2007 with visual studio 2005, my form is hosted in the formControl in a windows application.
I have a combobox that has a rule set up against it to check to see if the value entered matches any of the values in a secondary datasource. If it does not i pop up a message, if it does it populates the selection. I am doing this because i have a treeview control in my visual studio project and if the selection of the treeview control matches any of the values in my combobox (i.e. the secondary datasource) i want the value of the datasource to fill the combobox, if it does not i pop up an error message. This works beautifully.. The problem occurs because the users have the option of manually entering a value into the combobox, when they do this i update the secondary datasource so that the value will be in the list of values in the combobox however the rule fires BEFORE i ahve a chance to refresh the data connection with the newly added value so the error message always pops up, i use
this.DataConnections["Assets"].Execute();
in the context changed method of my form to update the datasource and the value does appear in the box after i do this however the RULE i have set up fires BEFORE the context changed method so the newly inserted value isn't in the datasource yet hence the error message... Is there anyother place i can refresh my datasource BEFORE the rule fires so that the combobox will contain this newly added value at the time the rule fires?