We show that a translation bounded measure has pure point diffraction if and only if it is mean almost periodic. We then go on and show that a translation bounded measure solves what we call the phase problem if and only if it is Besicovitch almost periodic. Finally, we show that a translation bounded measure solves the phase problem independent of the underlying van Hove sequence if and only if it is Weyl almost periodic. These results solve fundamental issues in the theory of pure point diffraction and answer questions of Lagarias.