The conduction and valence subband energies in the presence of an electric field are calculated using the fifth-order Runge-Kutta method. The binding energies of shallow donors, accepters and excitons in finite-barrier GaAs/Ga1-xAlx As quantum wells are then obtained variationally in the presence of a magnetic field. The effects of a spatially dependent screening function epsilon(r) On the calculation of binding energies are specifically investigated. The use of epsilon(r) in comparison with the use of a constant epsilon(0) increases the binding energy of accepters as the increase on shallow donors and excitons is quite small. (C) 1998 Academic Press Limited.