Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lose_Focus doesn't always work 1

Status
Not open for further replies.

kbieber

MIS
Aug 14, 2000
118
US
Here's one that I haven't seen before....

In sales order entry, I have some VBA code which needs to execute when the ship-to id loses focus. It works if I type in a ship-to id via keyboard. However, if I use the search window and select a ship-to from it, the VBA doesn't always work. When the VBA doesn't execute, the next field on the screen, ship-via code, does not update either. (The ship-via is returned from the altaddr table.) The problem seems to happen when I click quickly to the search window and select the ship-id quickly. It appears as if I'm getting ahead of the screen processing somehow.

After lurking on this list for a while now, I'm assuming I've run into another Macola quirk. But before I waste my time programming another kludgey work-around, I wondered if anyone else has seen this behavior....

Thanks.
 
We typically "trap" the flex code in various places because the code won't fire in certain situations. The lookup button being one of main ones. It may not be the best approach but if you want the code to work in all situations it's currently the only approach.

Kevin Scheeler
 
Thanks for the reply. I'm not a programmer by trade, so I don't know exactly what you mean by trapping the code. Could you provide a short example of how I would approach the problem?
 
In short you may have to put a piece of vb on the next fields got_focus event that simply

call ship_to_lose_focus

Actually you should make a global variable and when the code actually runs set it to false. Then on the got focus event only run it if the variable is true.

This would accomodate the users that dont use the search and actually run the code from the original field and will not run the second time.

Andy

Andy Baldwin
 
That's so obvious. I guess that's why I'm not a programmer. Thank you for the help.
 
Quite frankly.....nothing is that obvious in Flexibility.

Andy

Andy Baldwin
 
Since you are new to programming I wanted to add some further comments on Andy's solution.

1. Make sure that you set the global flag back to False in the Lose_Focus procedure that runs only when the Global Flag is set to True.

2. You will want to make sure that you reset the global flag to True each time you get focus on the Ship-to ID.

Scott Travis
NEXO Systems, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top