Raymond,
The When() event occurs once just before a control gets focus. If you return .f. from the When() the control will not accept focus.
You should put the code in the Click() method
>I have a command button with code in the When event. Sometimes when the button is clicked the code in the button is not executed, other times it works fine.
>
>How can I make it fire every time?