Can you post back with the output from a working query using a session variable with a number value and also the output from the query using the session variable with a text value. I would like to see the actual query that is ok versus the one that is not ok.
You can get these queries to print to the screen using the die statement in message #2. Normally when you are setting up the data to be filtered you will need to enter the data type. If you have a text type of value and use a number you can get an error, and the same goes for the other way around. This is what it sounds like you are experiencing. Looking directly at the queries is a good way to see what the difference is.