We present a (B,T)-phase diagram of the magnetic superconductor TmNi2B2C obtained by neutron scattering. The measurements were performed in magnetic fields up to 6 T applied along the crystalline a axis. The observed phases are characterized by three ordering vectors, Q(F)=(0.094,0.094,0),Q(AI)=(0.483,0,0), and Q(AII)=(0.496,0,0), all with the magnetic moment along the c axis. In zero and low fields the Tm 4f-moments order in a long wavelength transverse spin density wave with Q=Q(F). The magnetic Q(AI) structure is stabilized by an applied field of 1 T and a transition to Q(AII) is observed at 4 T. For both transitions there is a broad temperature and field range of overlap between the different states. Surprisingly, we observe that the Q(A) phases persist to increasingly higher temperatures when the field is increased. Doping with Yb has been introduced to partly suppress superconductivity. In (Tm0.90Yb0.10)Ni2B2C the Q(F)-->Q(AI) phase transition is also observed but at a larger transition field compared to the undoped compound. In (Tm0.85Yb0.15)Ni2B2C the Q(F) phase persists up to at least 1.8 T. The magnetic correlation length of the Q(AI) phase in TmNi2B2C measured parallel and perpendicular to the magnetic field, is constant within 10% at all fields and temperatures.