Nesting errors are caused when you put program loops inside other program loops and don't terminate the loops properly.
For example Do must be terminated with a Loop. For N must be terminated with the line Next N (although in reality, a harmless bug in DB means that you can have For N= ... Next P and it will still work).
If blocks must be terminated with Endif and so on.
The following code will cause a nesting error as the For M loop should be terminated with Next N - Not Endif as I have put.
For N=1 To 10
Repeat
For M=1 To 10
Endif
Until A=4
Next M
TDK_Man