Mahmood via Cindy,
>> Is it possible to have a sub function within a procedure in a form?
>
>No, you can't do this, but what you can do is create a Cal method for your form and call THIS.Cal(). Alternatively, you can put Cal in a procedure library PRG file (or a PRG by itslef) and reference it using SET PROCEDURE TO Cal.PRG.
To add to Cindy's reply, you can also
DO ProcName IN ProcPRG
and avoid having to first save the SET PROCEDURE TO setting, and then restoring it. Or checking if it's already in the SET PROC TO list. Much easier, and more reliable, IMO.