Actually, when you enter a different room, your brain stores the thing you were looking for in your long term memory. So the reason you can't remember is because you were thinking about it before you walked in the room and you're searching your short term memory for it.