General information
Category:
Coding, syntax & commands
This is a correction to PROC OnEsc
...
>IF lcOption $ "Yy"
> RETURN TO myproc && instead of xx
....
Sorry.
>Bela,
>You don't have to Cancel the execution of the program to stop the SQL select.
>Try this:
>Put the following code in a PRG and run it. Either way it will return the control to myproc. The difference is that RETRY will branch back to the SQL statement and RETURN TO myproc will return to the line following the SQL statement. Of course, the code below can be improved:
>
>*PROC myproc
>*************************
>ON ESCAPE DO OnEsc IN myproc
>** Your SQL SELECT statement here
>WAIT WINDOW "This is the line following the SQL statement"
>RETURN
>
>*************
>PROC OnEsc
>*************
>lcOption = ""
>WAIT WIND "Stop process ?" TO lcOption
>IF lcOption $ "Yy"
> RETURN TO xx
>ELSE
> RETRY
>ENDIF
>RETURN
>
>HTH
>Sorin
>
>
>>Hi Barbara!
>>
>>Thaks for your answer. Yes you are right, and I was a fool. But first I tried the way, that you wrote, the SQL statement was not terminated. Because, all the VFP documentation said, that issuing the Retry statement will continue the execution of last statement, but nowhere there was documented, that only an explicit Cancel will stop it. So this was my failure. After long trying, I get this:
>>
>>on escape do myproc
>>
>>procedure myproc
>>if <>
>> Retry && or nothing
>>else && in case of cancel
>> Cancel
>>endif
>>endproc
>>
>>
>>BB
>>
>>>>Hi everybody!
>>>>
>>>>Do anybody know a way with there can be terminate a long SQL select, if the user press ESC or click on a PushButton?
>>>>I thought on a dummy function which checks user input in SQL command, but what is the command, which terminate the SQL select?
>>>>
>>>>select *, dummy() ...
>>>>
>>>>function dummy
>>>> if
>>>>
>>>> endif
>>>>return .f.
>>>>endfunc
>>>>
>>>>TIA
>>>>
>>>>BB
>>>
>>>Bela, just using the Escape key will stop an SQL-Select if you have SET ESCAPE ON. Just set this to ON before the SQL, and re-set to OFF afterwards if you usually have ESCAPE set to OFF.
>>>
>>>HTH
>>>Barbara
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only