"Maximum Stack Depth Exceeded" Error Message
The "maximum stack depth exceeded" error message can occur if you put a script on the OnFetch event and you scroll through records quickly, or if you put a script on a button and then press the button repeatedly. There may be other ways in which the error can occur. The error occurs because the script is invoked a second time before the current instance of the script has finished executing.
The following technique in Xbasic should eliminate the error message by preventing the script from executing while a previous instance of the script is still running.
dim shared busy as L 'declare a shared logical variable if (.not. busy) then 'don't execute the script if previous instance still running busy = .T. 'put the Xbasic commands that you want to execute here busy = .F. end if
dim shared busy as L if (.not. busy) then busy = .T. parentform.fetch_next() busy = .f. end if