Donkhead333 and SBS n SMRT are correct. Iodoform reaction only
works on methyl aldehydes, methyl ketones and methyl alcohols
(which are actually automatically oxidized to methyl aldehydes /
ketones first, before the iodoform reaction occurs).
The reason why the iodoform reaction as well as the 2,4-DNPH
reaction works only only aldehydes & ketones, but not
carboxylic acids, esters or amides, is that the latter group are
resonance stabilized and are therefore less reactive (remember :
the more stable you are, the less reactive you are) than the former
group. The iodoform and 2,4-DNPH test requires a level of
reactivity that only the former, but not the latter group of
compounds, meet.