You need to use the GotFocus event to do that. Instead of Return, you can use something like AnotherControl.SetFocus.
>Hi Moreau,
>
>I need to execute some code before getting focus. For Example, I want to check if a flag is true then control get focus otherwise not.
>
>if addMode or editMode then
> return
>end if
>
>i initilize these flag in add button or edit button. When user click add button then the controls get focus.
>
>yours
>
>Nafees
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com