with thisform .LastActiveControl=.ActiveControl do form search_listbox if type('thisform.LastActiveControl')="O" wait window thisform.LastActiveControl.value * thisform.LastActiveControl.Value=c_Codigo * thisform.LastActiveControl.SetFocus() else =messagebox("Sorry, Pal. Try again...", 48, "Nice try") endif endwith