Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form not performing form_load

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
0
0
AT
ok I have a grid from which i get the ID field, based on that ID i open a 2nd form and fill it with data. After that I need to close the 2nd form go back to the grid, select another ID and open the 2nd form again and have it fill up with data. It works just fine the first time I do it, but at the 2nd time, 3rd etc...the data stays the same from the first time i opened it. In fact i put msg boxes in the form_load to see if it even executes the code and it doesnt. Its like it stores in cache somewhere and every time i open the form again it uses the stored form with data. I use form.show form.hide to open and close the forms.

Any ideas why it doesnt execute the form_load code on the 2nd time i open the form? Or any ideas at all on what it could be? I am clueless here :(

thanks in advance
 
The FORM_LOAD only runs when the form is loaded into memory. If the form was never removed from memory before you went back to it, the FORM_LOAD would will not run again. The FORM_ACTIVATE however will run everytime the FORM gets focus. - Jeff Marler
(please note, that the page is under construction)
 
Hmm i see thanks Jeff i'll try moving the code over to form activate, but is there a way to remove the form from memory? Or is it generally better to always put the code in form activate instead of form_load ?

thanks :)
 
worked! thanks again :)
 
One problem though, form_activate performs every single time the form gets focus which is not good :( What can i do to have it perform only once when the form is opened? Any way i can remove the form from memory and use form_load() ?

 
try this

unload objform
set objform = nothing


and yes, as I mentioned, the FORM_ACTIVATE will get call EVERYTIME the form gets focus . . . not just the first time. - Jeff Marler
(please note, that the page is under construction)
 
"form.hide" does only hide the form, it is still in memory while "unload form" does remove it from memory.
If you want to perform the "form_load" without the form to become visible, you can call "load form"

If your controls are bound to the database, you can use "control.Refresh" and still use the ".show" and ".hide".
This would avoid loading and unloading the form2 and would be much more fast.

Good luck, hope it can help a little more
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top