Obviously, dimming an array to be size -2 is a bad idea. I would expect your typical DBPro error prompt, but you don't see that. In windows 7, it just crashes "Has stopped working and needs to close". Takes forever to track down.
ArraySize as integer
ArraySize = SomeFunction()
global dim SomeArray(ArraySize)
wait key
end
function SomeFunction()
` This function is suppose to return the size of the array you need based on some SQL query or other formula.
` However, something goes awry and it ends up returning -2 instead
i = -2
endfunction i