Reducing sugar is a surefire to prevent cavities
Limiting your child's sugar intake is the best way to prevent any cavities from forming, other than brushing their teeth. Sugar is a necessity for bacteria to survive--but what you have to remember that it isn't the amount of sugar that you eat that counts, it is the frequency that matters. This is because when you expose your teeth to sugar repeatedly, your saliva is prevented from properly cleansing your teeth.
Don't go blaming this all on candy. Starchy carbs, like crackers and cereal, along with stick foods like raisins, can also contribute to tooth decay.