How to Unload a Form

Anyway to unload a form and refresh its contents?

Do you clear all the input fields on a form?

Try this:


I’m having similar issues I think, I hope it’s okay to post my findings in this question.

I want to show some localstorage variables when a form loads, so I’ve put these in the Sub Main like this:

Sub Main()
    txtDisplayName.value = localStorage.getItem("DisplayName")
    txtEmailAddress.value = localStorage.getItem("EmailAddress")
    txtPassword.value = ""
End Sub

But this seems to only run the first time the form is loaded.

If I then want to go to another form, I am using the Form.hide() function and then showing the selected form; however, when I choose to go back into this form I want the txtPassword to be blank. I can reset the form prior to showing the new form, but when I reshow this form it is not running the Sub Main again?

So txtPassword.value is returned to nothing with a form.reset() call but it also clobbers the txtDisplayName.value and txtEmailAddress.value at the same time.

I hope that makes sense.

I tried that I am referring to the pdfPrint Function. It prints the pdf well on the form and a pdf file. I have an option to continue and oupt more info,I reset the form with new info but it prints back the info from before or the first pdf.

If you’re using the ChangeForm() function to go to your new form, there is an Form1.onformshow() function which gets called each time you go to that form. (There is also a onformhide() function)