The developers of the new cocaine vaccine, known as 'TA-CD', are doing essentially the same thing by cleverly combining a deactivated cocaine molecule with a deactivated cholera toxin molecule. The deactivated cholera toxin is enough to trigger the immune system, which finds and adapts to the new invader.
If effective, you can see that some parents might want to vaccinate their non-addicted, perfectly healthy children, so they are 'immune' to cocaine. The difference here, is that once given, the 'immunity' may be permanent. In other words, you would make the decision that your child will never be able to experience the effects of cocaine for the rest of their life.Another option (and one with a whiff of authoritarianism about it, though perhaps not much more than the militarised, prison-filling War On Drugs) would be a compulsory mass vaccination programme, perhaps of all school-aged children. Implemented on a large enough scale, this could be the only way of killing off the cocaine cartels other than legalising the stuff (politically unpalatable) or rendering coca extinct by biological means (an ecological non-starter).
A vaccine against heroin may also be possible, though one wouldn't want to ever be in need of strong painkillers if one has had one of those.