>Hilmar,
>
>It finally works perfect. This is the code below that's got it working.
>Thanks again for your help.
>
>DO while(AsbDoc.ad_menu='D')
>DEFINE BAR i of keydoc PROMPT (Allt(AsbDoc.ad_label))
>cRun = “SHELLEXEC(‘“+Allt(AsbDoc.ad_file)+”’)”
>ON SELECTION BAR i of keydoc &cRun
>i=i+1
>Skip
>ENDDO
OK. BTW, a loop that processes records is usually simpler with SCAN than with DO.
Adapting your example:
SCAN while(AsbDoc.ad_menu='D')
DEFINE BAR i of keydoc PROMPT (Allt(AsbDoc.ad_label))
cRun = “SHELLEXEC(‘“+Allt(AsbDoc.ad_file)+”’)”
ON SELECTION BAR i of keydoc &cRun
i=i+1
ENDSCAN
Here, only the SKIP was omitted. In some cases, you save more. For instance, a loop that processes all records, with DO WHILE:
go top
do while not eof()
(do something)
skip
enddo
And with SCAN:
scan
(do something)
endscan
Also, to process all records that fulfill a certain condition, you can:
SCAN FOR (condition)
...
ENDSCAN
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)