The best way to avoid getting toothache and other dental problems is to keep your teeth and gums as healthy as possible. To do this, you should:
Make sure you have regular dental check-ups, preferably with the same dentist.
The time between check-ups can vary, depending on how healthy your teeth and gums are and your risk of developing future problems.
Your dentist will suggest when you should have your next check-up based on your overall oral health.
Children should have a dental check-up every six months so tooth decay can be spotted and treated early.
SOURCE: NHS UK
http://www.nhs.uk/conditions/Toothache/Pages/Introduction.aspx