We present a comprehensive neutron-diffraction study of the magnetic structures of ErNi2B2C in the presence of a magnetic field applied along , , or . In zero field, the antiferromagnetic structure is transversely polarized with Qapproximate to0.55a* and the moments along the b direction. At the lowest temperatures, the modulation is close to a square wave, and transitions of Q between different commensurable values are observed when varying the field. The commensurable structures are analyzed in terms of a detailed mean-field model. Experimentally, the minority domain shows no hysteresis and stays stable up to a field close to the upper critical field of superconductivity, when the field is applied along . Except for this possible effect, the influences of the superconducting electrons on the magnetic structures are not directly visible. Another peculiarity is that Q rotates by a small, but clearly detectable, angle of about 0.5degrees away from the  and the field direction, when the field is applied along  and is approximately equal to or larger than the upper critical field.