Type mismatch is a general error that happens when you try to stuff one type of value into a variable of another type.
Let's say you are working with numbers, adding and subtracting them. You're working with
And then at some point you say something like
HighVal = "XYZZY"
your operations are soon going to fail with a type mismatch error.
The easiest way to figure out where you went wrong is to do a response.write of each value along the path. That way you can see exactly what each value is set to, and figure out which one is getting in a "bad" value.