Actually there is no effect for your hearing when you wear your glasses on. If you have such feeling of better hearing or worse hearing, it is from the psychological role. Although the nerves in the eyes and ears are interlinked, you will not have better hearing because of the wearing of the glasses. When you wear the glasses, you will see better at the vision. That is true.
Well, it seems that you are very curious about this phenomenon. Anyway, I myself also find it very strange if you insist on saying so. So, from what I know, it may be resulted from the fact that with the help of glasses, you could better focus on the things that make sounds and could thus have better hearing.Or it is because glasses could help you concentrate on hearing something.
Well, in my opinion, there is nothing to do with your glasses when you want to hear well. As we know that if you have vision problem, you can just wear prescription glasses to improve your vision. In that way, it will just make you see well. But on the other hand, we can not say that when you wear glasses, it will make you hear well. so maybe it is just your own feeling. anyway, you can console it with your doctor.