Please read Before you make a query thread regarding code snippets.
7) Use code tags. Use the appropriate code tag (e.g. [ php][/php ] and [ code][/code ]) to make your code easier to read. See BB Code Section for [Code]
Also you need to break the loop where you are deleting so that the AcceptChanges is on the correct RowCount