Vaccines don’t work instantly. It takes a few weeks for the body to build up immunity after receiving a dose. And the vaccines now in use in the U.S., from Pfizer-BioNTech and Moderna, both require a second shot a few weeks after the first to reach full effectiveness.
Nor do they work retroactively. You can already be infected and not know it when you get the vaccine — even if you recently tested negative. That infection can continue to develop after you get the shot but before its protection fully takes hold, and then show up in a positive test result.
The vaccines prevent illness, but maybe not infection. Covid vaccines are being authorized based on how well they keep you from getting sick, needing hospitalization and dying. Scientists don’t know yet how effective the vaccines are at preventing the coronavirus from infecting you to begin with, or at keeping you from passing it on to others. (That’s why vaccinated people should keep wearing masks and maintaining social distance.)