I would like to share what I have learned and perhaps get a tip on best practice.
I have a User Form with a two Frames (fr) that each contain several Text Boxes (tb).
The _Enter code works exactly as expected. I wasted a lot of time trying to figure out why the (tb)_Exit code didn't consistently run.
What I figured out is the (fr)_Exit code supersedes the (tb)_Exit when you click out of the frame. Clicking from (tb) to (tb) within a frame allows the "local" (tb)_Exit to work as expected.
My workaround is to have the (fr)_Exit code call each (tb)_Exit for the (fr) members.
I realise this may cause unwanted behavior in some cases, when a particular (tb)_Exit may only need to be trigged when actually exiting that control. My workaround for that is to have a module-level boolean variable that is set True by the (tb)_Enter code. Then my (fr)_Exit will only call a particulr (tb)_Exit if its set flag is true. The (tb)_Exit code will always clear its flag.
Any ideas?
Bookmarks