>I use the following general form pretty widely:
>
>action=messagebox('Do you really mean this?',259,'Daft Entry in Field')
>if action <>6
> return .f.
>endif
>
>which works happily enough in most situations but I have just tested a new text box and found it refusing to work. It asks the question, accepts 'No' for an answer, returns .f. and then blithely allows the focus to move to the next field.
>
>here is the precise code:
>
>if not IgnorePaymentTomorrow
> if this.value=date()+1
> action=messagebox("You have entered Tomorrow's date - "+dtoc(thisform.paydate)+chr(13);
> +'Is this what you really meant?',259,'Payment Tomorrow!')
> if action<>6
> return .f.
> endif
>
> action=messagebox("Are you likely to enter further Payments (during this session) with Tomorrow's date?",259,'More Tomorrows?')
>
> if action=6
> ignorePaymentTomorrow=.t. && don't irritate the user if they've already told us they're entering more like this
> endif
> endif
>endif
>
>
>the debugger shows that answering No correctly make 'action' =7 and the code runs the 'return .f.' line and exits the valid but moves directly to the lostfocus rather than back to the setfocus.
>
>any ideas?
>
>
>
>Harry
You don't say what method/event this is in. It should be in the ValidEvent.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer