use ASTACKINFO , как сказал MikeReigler, затем что-то вроде этого:
cStack = ""
nStackCount = astackinfo(arrStackInfo)
for nCount = nStackCount to 1 step -1
cStack = cStack + "Level " + transform(arrStackInfo(nCount, 1)) + chr(13)
cStack = cStack + iif(not empty(arrStackInfo(nCount, 2)), ;
"Filename: " + transform(arrStackInfo(nCount, 2)) + chr(13) , "")
cStack = cStack + iif(not empty(arrStackInfo(nCount, 3)), ;
"Module/Object name: " + transform(arrStackInfo(nCount, 3)) + chr(13) , "")
cStack = cStack + iif(not empty(arrStackInfo(nCount, 4)), ;
"Module/Object filename: " + transform(arrStackInfo(nCount, 4)) + chr(13), "")
cStack = cStack + iif(not empty(arrStackInfo(nCount, 5)), ;
"Line # : " + transform(arrStackInfo(nCount, 5), "999999") + chr(13), "")
cStack = cStack + iif(not empty(arrStackInfo(nCount, 6)), ;
"Code: " + transform(arrStackInfo(nCount, 6)) + chr(13), "")
cStack = cStack + chr(13)
next