• Results correct only on stepping in the codes (A2K SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Results correct only on stepping in the codes (A2K SR1)

    Author
    Topic
    #374371

    I have a main form A which called Form B for adding records. In Form A, there is a text box which showed the total number of records in my main table. After adding records in Form B and returning to Form A, I discovered that text box didn’t show the updated record number. When I did debugging and stepped into the codes, the value for the textbox was correctly shown when my cursor was over it, and after I finshed executing the codes and return to the main Form, the text box showed the correct updated record number. However, when I cleared the breakpoint and added records using Form B and returned to Form A, the text box again failed to update. When I put back the breakpoint and run again, the text box showed correctly again.

    Barring errors in my codes, why should using breakpoint and stepping into the codes give me different result from just running it without breakpoint and stepping in? What did the de###### do?

    Viewing 0 reply threads
    Author
    Replies
    • #605394

      Access probably forces recalculation after a breakpoint and after each step when you are stepping through code, so that you can see the effect of each step. When running without a breakpoint, recalculating all the time is inefficient.

      Try forcing a recalculation of Form A on returning from Form B. If you use a command button to close Form B and return to Form A, you might add a line like the following to the OnClick handler of the command button:

      Forms![Form A].Recalc

      As an alternative, you might put the recalculation in the OnActivate event of Form A:

      Me.Recalc

      • #605565

        The solution you suggested worked very well. Thanks. Well, I have to be sure that what showed well while in debugging session worked the same while out of debug mode.

    Viewing 0 reply threads
    Reply To: Results correct only on stepping in the codes (A2K SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: