>>IF MCard_Nbr <> Card_Nbr .OR. DELETE()
>> nodefault
>> do quickmsg with "CUSTOMER'S CARD NO. NOT ON FILE"
>> thisform.mytextbox1.setfocus()
>> thisform.refresh
>>ENDIF
>
>I have one textbox and a quit(cmdbutton). The user enters his data and if it's not on file, I want the setfocus to go back to the textbox. Pure & simple. I think
>
>
>>
>>>>>>>For some reason the focus does not get set in the following:
>>>>>>>store allt(thisform.mytextbox1.value) to mcard_nbr
>>>>>>> SEEK MCARD_NBR
>>>>>>> IF MCard_Nbr <> Card_Nbr .OR. DELETE()
>>>>>>> do quickmsg with "CUSTOMER'S CARD NO. NOT ON FILE"
>>>>>>> thisform.mytextbox1.setfocus()
>>>>>>> thisform.refresh
>>>>>>>
>>>>>>>Is there a fault here?
>>>>>>>thanks
>>>>>>
>>>>>>If this code is being executed in a Valid event, Setfocus() can not be executed in the Valid in VFP5.
>>>>>>
>>>>>>Bill
>>>>>It's evaluated in the keypress event, forgot to mention that.
>>>>
>>>>KeyPress does not seem like the place to execute this code or it will be executed on every key stroke and the record could not be found until the whole card number was entered.
>>>
>>>Actually, I left out one last thing, the only keypress it checks is if the user hit enter thus: if nkeycode=13
>>>otherwise it works correctly ,cept for the setfocus part.kenweber
GCom2 Solutions
Microsoft Certified Professional