  About 5% of upper main sequence stars are permeated by a strong magnetic
field, the origin of which is still matter of debate.
  With this work we provide observational material to study how magnetic fields
change with the evolution of stars on the main sequence, and to constrain
theory explaining the presence of magnetic fields in A and B-type stars.
  Using FORS1 in spectropolarimetric mode at the ESO VLT, we have carried out a
survey of magnetic fields in early-type stars belonging to open clusters and
associations of various ages.
  We have measured the magnetic field of 235 early-type stars with a typical
uncertainty of about 100 G. In our sample, 97 stars are Ap or Bp stars. For
these targets, the median error bar of our field measurements was about 80 G. A
field has been detected in about 41 of these stars, 37 of which were not
previously known as magnetic stars. For the 138 normal A and B-type stars, the
median error bar was 136 G, and no field was detected in any of them.
