I just went back to have a look. The code is very hard to follow. It appears you are calling the click event from the mouse up event. You are also calling it from the double click event. I haven't tested this myself but there is a chance that this could cause the click event to fire twice when you single click and 3 times when you double click.

I see where you set the variables - to subitems(2) Not sure why you are bouncing around using 3 different ways of calling the same query nor am I sure why you are calling the click event in such cases but it makes it very hard to keep track of what is going on and as a result would make it hard to locate your problem.

When your error occurs check the variables and the subitems value to see what they are at the time of the error and maybe that will help.