Dear student.
Diarrhea is caused by various factors, common agents which cause diarrhea include Campylobacter, Salmonella, Shigella and Escherichia coli. Even viruses (rotavirus, enterovirus) or protozoan (Entamoeba histolytica) can also cause the disease.
Vaccination is the process of immunizing an individual against any particular disease caused by a particular organism, as diarrhea is caused by a number of factors, vaccination will not work in this case.
Regards.