if you changed to
IF LASTKEY() = 13
...IF MDOWN()
......RETURN .T.
...ELSE
......THIS.Parent.Command1.Click()
......RETURN .F.
...ENDIF
ENDIF
it should probably work. In other words, if the user is clicking, you want the click to work.
Joe
>Hi Erik,
>I appreciate the advice, both solicited, and unsolicited, but this code brought up a different problem. Focus cannot leave the textbox once it has been entered if I have this code in the valid. I couldn't even click the exit button, so I had to use my hotkey alt-x to exit.
>
>>IF LASTKEY() = 13
>>THIS.Parent.Command1.Click()
>>RETURN .F.
>>ENDIF
>
>
>>Unsolicited advice:
>>It's usually considered bad practice to put call code in events. Instead of >running the click method from the textbox, put the code that's in the click >method in a custom form method, and call it from both the textbox and button.
>
>Are there specific problems that this can cause, or is it simply something they say not to do?
Joseph C. Kempel
Systems Analyst/Programmer
JNC