General information
Category:
Coding, syntax & commands
Hi, Andrew-
>What would be an effective and efficient way to branch code execution in the following scenario;
>
>Textbox1 on form1
>
>Lookup for possible values for textbox1 on form2
>
>If textbox1 is empty, abandon new record, *unless* form2 has gotten focus, ie: user wishes to lookup value for form1.textbox1 using form2.
>
>I already have the code for EMPTY(this.value) on form1.textbox1.lostfocus. Where could I test for form2.gotfocus()?
Activate() and Deactivate() are the methods that correspond to GotFocus and LostFocus. However, the problem in your scenario is that the TextBox Valid and LostFocus will fire before Form1.Deactivate and Form2.Activate. So, you have a catch-22.
It's much cleaner, and more common, to call the lookup form from the valid, or lostfocus of the TextBox if the value is empty. Or, from what you've described, it sounds like they will have to select an existing value, so wouldn't a combobox work?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only