My babys formula was switched today by the doctor and he doesn't like it but has to have it. How can I get him to eat it?

Be patient. This is one of those situations where you need to exercise some patience. Try to introduce it slowly, perhaps alternating with the previous formula he had. There are a couple of really nasty tasting formulas that are intended for very special situations. With the information that you provided, one cannot elaborate anymore.
Insist on it. Some formulas simply taste bad. The key is to "stick to it". After 7-10 takes, she will like it for sure. I tip i can give you, if she "just won't drink it" is to prepare formula as indicated in can, then add plain pedialyte (ie. 2 ounces prepared formula w 2 oz pedialyte). This dilutes the bad flavor a bit so she'll accept it. Then begin taking away pedialyte over 1-2 days.