In InfoPath, the order of processing when a user clicks a button is: Rules Code When you write your OnClick event handler, take into account that any rules associated with the button will be processed before the code is reached. This can be very useful, but can also create some headaches if not understood...