Vaccines do not prevent the infection, but they help shorten the possibility of getting the infection. When getting a vaccine you are really just injecting a small amount of the infection/disease into your system so that your white blood cells can start working at fighting off the disease, that way IF you end up catching the infection, It is no longer foreign to your cells and that way they can fight off the disease quicker. Hope that helps :)