>>>Got a date range, and if the Beginning Date is empty, but the user puts a something in the End Date, I need to display an error message and put the focus back in the Beginning date.
>>>
>>>So, someone please remind me how to do that?
>>>
>>>Thanks
>>
>>It seems folks do not use Foxpro too often anymore.
>>Firstly, you should use txtEndDate.Lostfocus event. If you want trigger it just in case user actually typed something then flank the tag in both Gotfocus and Lostfocus event. Use Setfocus with Nodefault to return focus to the box.
>>
>>*** txtEndDate.Gotfocus
>>This.Tag=Dtos(This.Value)
>>*** txtEndDate.Lostfocus
>>If This.tag==Dtos(This.value)
>> Return
>>Endif
>>If Not Empty(This.Parent.txtBeginDate)
>> Return
>>Endif
>>=Messagebox("My Message")
>>This.Parent.txtBeginDate.Setfocus
>>Nodefault
>>
>
>Checking for the Esc key would be nice, too, so the user doesn't get trapped in the field.
Esc key is not needed here, because focus gets moved to another box. In case of setting focus to itself, textbox.value should be restored by tag, so user may continue moving around the form without typing entry.
Edward Pikman
Independent Consultant