DataMinerHome
Registered User.
- Local time
- Yesterday, 21:29
- Joined
- Jan 4, 2010
- Messages
- 57
I am using Allen Browne's code http://allenbrowne.com/ser-35.html to open multiple instances of a form.
I have a button on the form which does:
However, when I use the button to close a form instance, the wrong instance closes. It seems the instances always close in the order that they were opened, regardless of which instance I am actually trying to close. The hwnd for me.name always seems to be the "oldest" in the collection of open instances.
When I use the standard "X" in the upper right corner of the form to close the instance, the correct instance closes.
So, what code do I need to put behind my button to get the correct instance to close?
OKay, never mind, I found another thread in this forum that just says to use Form_Close. That seems to work. But here's another question: When you use the Access wizard to create a close button on a form, it (in past versions of access) directed you to docmd.close, and now in access 2007 it creates an imbedded macro. So, do the folks at microsoft know something I don't know? Why in the world wouldn't you always just use Form_Close????
I have a button on the form which does:
And in the on-close event I have:DoCmd.Close acForm, Me.Name
(see the link to see what RemoveInstance does)RemoveInstance Me
However, when I use the button to close a form instance, the wrong instance closes. It seems the instances always close in the order that they were opened, regardless of which instance I am actually trying to close. The hwnd for me.name always seems to be the "oldest" in the collection of open instances.
When I use the standard "X" in the upper right corner of the form to close the instance, the correct instance closes.
So, what code do I need to put behind my button to get the correct instance to close?
OKay, never mind, I found another thread in this forum that just says to use Form_Close. That seems to work. But here's another question: When you use the Access wizard to create a close button on a form, it (in past versions of access) directed you to docmd.close, and now in access 2007 it creates an imbedded macro. So, do the folks at microsoft know something I don't know? Why in the world wouldn't you always just use Form_Close????
Last edited: