Stomach pain and vomiting are often two symptoms that go hand in hand.
Stomach pain followed by vomiting is often caused by the stomach being irritated by bad food or disease, causing the stomach to reverse its movements frequently and violently to expel the contents of the stomach causing vomiting.
Vomiting followed by stomach pain is often caused by damage or irritation of the stomach due to vomiting, for example, violent vomiting can cause damage to the cardia of the stomach with blood visible in the vomit.