Why do dairy products suddenly taste bad?

I have a weird problem that happened to me once when I was maybe 8 years old (I'm 20 now). I woke up one morning and all dairy products tasted horrible. They tasted as though they had gone bad. I'm not sure how long it lasted back then because I just stopped eating all dairy products for a couple of years — I was afraid they would taste bad, but it definitely lasted several months. When I started to have them again they tasted fine. It seems to have started again. What could possibly be the cause of this?