your itemscat recordset should remain on the top of the page. Only the colors recordset should be inside the loop.
GetSQLValueString function declaration code should also only appear at the top. You are getting closer, but don't act blindly... try to understand what you are doing and why if you can otherwise this stuff will never get easier.