We consider quantum p-form fields interacting with a background dilaton. We calculate the variation with respect to the dilaton of a difference of the effective actions in the models related by a duality transformation. We show that this variation is defined essentially by the supertrace of the twisted de Rham complex. The supertrace is then evaluated on a manifold of an arbitrary dimension, with or without boundary.