Getting the difference between two counts in Microsoft Access Report
I have a report which lists 2 fields namely appointments and absences. Now what I want is that after building the report, I want to get the difference between these 2 counts. Is that 开发者_开发技巧possible?
thanks!
If your report has two fields on it, Appointments and Absences, and they are named the same, create an unbound control and assign its ControlSource to be this:
=[Appointments]-[Absences]
Now, I wouldn't really recommend using that, since it's likely that the controls and the fields they are bound to have the same name. I'd rename the control that is bound to Appointments as txtAppointments
and the one bound to Absences as txtAbsences
, and the calculation would then be [txtAppointments]-[txtAbsences]
.
Now, keep in mind that this assumes that neither field is ever Null. If it is, you probably want this, instead:
=Nz([txtAppointments], 0)-Nz([txtAbsences], 0)
Try and see if it works!
精彩评论