mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (October 2005)

Using a Message Box in a Macro Triggered by a Get Focus Event

If the Get Focus event for a control triggers a macro and that macro puts up a message box, the user may not be able to dismiss the message box. In particular, when the user presses OK, the message box will just reappear.

Why is this happening?

The message box gets focus when it comes up and returns focus back to the control when the user presses OK button. But returning focus back to the control will cause the Get Focus event to trigger the macro again...causing the message box to come up again.

To prevent this race condition, before you put up the message box, have your macro set focus to some other control. That way, when the message box is dismissed, the Get Focus event will not be fired.