Originally Posted by
twgonder
@kd2017, Post #25 It sounds like you may be doing what I did in post #8. But I'll check to be sure.
What hasn't been answered is if multiple instances of a form will also stomp on the module variables. It might be best to test that with the .accdb in thread #87614.
If your example is basically the same as mine in #8, then what I asked in post# 26 is very relevant.
No, multiple instances of a form will not stomp on *private* module variables... a module will stomp on it's own variables. If multiple instances of forms are calling the same module, and the module is modifying its own variables, then that's where your problem is.
I've not needed to create multiple instances of the same form object so I can't help, but review this http://allenbrowne.com/ser-35.html
If you take something of a 'functional programming' approach or mindset to this, and pass your variables to the functions defined within the module, rather than try to get your module to manage variables, you'd be good to go.
[edit]
I took a quick glance at your db from post #8. Out of principle I wouldn't go to the trouble to create a private variable in the form only to let a module modify it directly. I would rewrite sFrmLoad like so:
Code:
Public Function sFrmLoad(ByVal aW As String) As String
If aW = "P" Then
sFrmLoad = "padre"
Else
sFrmLoad = "hijo"
End if
End Function
And use it from the form like this:
Code:
Private mWhat As String
Private Sub Form_Load()
mWhat = sFrmLoad("P")
End Sub