>>Greetings All,
>>
>>I had a student recently ask me if you can store code in a memo field so it can be accessed, compiled, and executed at runtime. I think this is possible with the COMPILE command, yes? I just haven't had a chance to research it yet...
>>
>>So, is it fairly striaght forward? Any traps I should tell him to watch out for?
>>
>>Thanks!
>
>Yep. Do it all the time - without the COMPILE command
>
>** e.g.,code in field mcode
>lcFile = FORCEEXT(FORCEPATH(SYS(2015),SYS(2023)),"PRG")
>COPY MEMO mcode TO (lcFile)
>* make sure it got out there...
>IF FILE(lcFile)
>DO (lcFile)
>ENDIF
>** clean up
>ERASE (FORCEEXT(lcFile,"*"))
Trey,
You can only do it without the COMPILE command if you're running FoxPro. An exe will tell you it cannot find the program refered to in lcFile unless you COMPILE (lcFile) first.
David.