Community medicine is a subset of preventive medicine.
Preventive medicine is that branch of medical science that aims to improve and maintain health by ensuring people do not fall ill in the first place.
On the contrary, curative medicine restores and maintains health by treating people after they fall ill.
Thus, (at the most basic level) preventive medicine targets the disease free state, while curative medicine targets the diseased state.
It may seem that these two are totally different things with nothing in common. In reality, though, preventive medicine includes curative aspects, and vice versa. More on this in subsequent posts.