locked
Control Source giving inconsistent results RRS feed

  • Question

  • I inherited an Access application and do not quite know how to debug some of the features.  There is a TextBox with a Control Source set to an IIf statement that includes a function to get the key for determining this statement.  Both results of the IIf statement are math expressions based on two values off the form, for simplicity labelled A and B.  In both cases, if I change the value of A, the calculated value is changed relative to that alteration.  If I change the value of B, however, nothing happens to the calculated value.  Even if I then change A afterwards, only the correct relative change occurs.  Furthermore, there was a change to the way the function was evaluated, which enables the first option to occur more frequently than in the past.  Any data recorded prior to that change will now not calculate correctly at all if a different option in the IIf statement is determined.  Again, changes to A will give the correct relative change, but the number is already way off. 

    My question is--is there any possible way to debug the statement in the Control Source?  Any way to step into it to determine what is being passed to the math expressions?

    Thanks in advance for any help!


    Christine A. Piffat

    Monday, November 19, 2012 10:29 PM

Answers

  • There are at least a couple of ways to approach this.

    You could examine each element in the immediate window (Ctrl + G), typing ?<yourelement> then press enter.

    You could also temporarly add an additional text boxeto your form for each element and set the control source to the element.

    That way you can examine all of the input elements to the textbox in question and see which is/are incorrect. Then fix as needed.

    • Marked as answer by Christy Piffat Monday, November 19, 2012 11:15 PM
    Monday, November 19, 2012 10:48 PM