-
on my form load, i set a dimmed variable to the value of a public variable on another form:
Code:
Private Sub Form_Load()
newSize = frmMain.prefList(1)
End Sub
Then I change the value of newSize, and when I unload the form, I set the public variable to the value of the dimmed value:
Code:
Private Sub Form_Unload()
frmMain.prefList(1) = newSize
End Sub
but when I open the form back up, the value of frmMain.prefList(1) is unchanged, an idea why that could be??
-
You declare public variables in a module.
-
actually, you can declare public variables on a form, you just have to reference them by the form on which they are declared, and as you can see, I have done that.
-
do you have newsize declared?
-
yes i do, and I placed one of those red dots on the "End Sub" line of the Form_Unload() sub. In the immediate widow, the value of frmMain.prefList(1) remains unchanged.
-
Hmm, this could be a tricky one, can you send your projects and i'll have a look?
-
hmm perhaps the form is unloading before the variable's value is passed? You could try placing that code in Form_QueryUnload and see if that works. I'd also set up a message box to kick off displaying newSize then frmMain.prefList(1) before the unload ... You may be able to pinpoint where and why it's dropping the value.