jwcolby
jwcolby at colbyconsulting.com
Mon Feb 23 11:33:04 CST 2009
Checkout the Default property of the command button. One and only one button can have its default property set true. If true this button will be clicked when the user hits Enter anywhere on the form. Set the Default property of the OK button to true. Now if the user clicks Cancel, they did not hit Enter and the Cancel button click fires as you would expect. Remove the code that calls the cmdOK_Click from the after update of the text box. John W. Colby www.ColbyConsulting.com Rocky Smolin at Beach Access Software wrote: > Dear List: > > I have a client app which opens to a form displaying log in combo, password > text box, a command button labeled OK and a command button labeled Cancel. > > The Cancel issues Application.Quit. The OK checks the password, and lets > the user in of correct. > > After entering the password the focus shifted to the OK button. So far so > good. > > Then the client wanted the user not to have to click OK after they entered > the password - just go right to the switchboard if the password was correct. > So I simply added Call cmdOK_Click to the After Update event of the password > text box and walla! no need to click OK. > > But now if the user enters a correct password and clicks Cancel, the program > still goes to the switchboard because of the After Update event call. I > can't see a way in the After Update event to know that the user clicked > Cancel. Screen.ActiveControl.Name still shows txtPassword. The After > Update event is triggering before the Cancel click event apparently. > > Is there a way to know the user clicked Cancel? > > MTIA, > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > www.e-z-mrp.com <http://www.e-z-mrp.com/> > > www.bchacc.com <http://www.bchacc.com/> > > > > > >