How soon after sex should you take a pregnancy test ?

I know missing a period is an obvious sign to first take a pregnancy test but how soon after sex that you have a slip up should you take a pregnancy test / could take one ? Please help