[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Recalculating forms

In processing forms I would like to go back to a previous form and
recalculate values. This does not work, as values previously calculated
remain fixed in form.  How do I get the prior forms to recalculate?
  • 2
1 Solution
Unload then load the form again
Basically, you have to make the subroutine your calling PUBLIC, then call whatever routine that calculated the values in the first place... Again.

For example, lets say you have a subroutine on form1 called CalculateForm, and it figures some numbers and puts them in textboxes on Form1...

You would change the:

   Sub CalculateIt()


   Public Sub CalculateIt()

Then in your other form, you can do:


The calculation routine will run.  You may need to do a Form1.Refresh to repaint the screen.

forrestxAuthor Commented:
For mcrider- thanks much, you put me on the trail of the solution.  My problem was not too well described:  I calculate values in form1, and appraise in this in a series of later forms, with option to go back and redo form1 when things are not OK. What happens is that the form_load routine in form1 refuses to run on the rerun. I tried loading, unloading, refresh in form1 and calling form, refresh on a timer, etc. and etc. and nothing works. A stop command tried in form1 form_load that operates on the first go will not work in the form_load sub in form1 on return to it, but program then halts at the stop even though the stop does not execute. This proves that the problem is in the Form_load sub. The operations in form1 will run on the rerun but only after a command to another sub therein is pressed. But because the form_load material is not there to advise user what to do this is no good.
  I could not find a way to call form1 form_load routine from the calling form. But I put all material in the form1 load sub in a public sub as you suggested, calling this from Form_load in the first go, and then calling it from the calling sub on the rerun as you suggested and IT WORKS!

Thanks again.
Forrest Blanding  forrestx@home.com
Thanks for the points! Glad I could help!


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now