Create Better MS Access Reports
Report Builder for Microsoft Access helps you create dynamic, professional-looking reports fast! The easy-to-understand wizard helps you with complex tasks like calculated fields, adding subreports, customizing styles, as well as grouping and sorting. Download a free trial today!
If you store values in your database to indicate choices for your uses to make, such as storing values like Yes/No, True/False, Male/Female, Adult/Child, there may be times when you would like to make calculations on this data. You can do this using the Count and IIF expressions.
If we take the following table, that stores data relating to Employees, you will see that one of the fields stores a value to indicate whether the Employee is Male or Female:
In this example, you can see that we store a single text value to indicate whether the Employee is Male (M) or Female (F).
Now if we use this information in a Microsoft Access report, we may want to calculate how many Male/Female employees that we have in our records.
We can do this by adding a couple of Unbound text boxes into the Report Footer that use the Count and IIf functions. We need to add one that counts if the records contain a value in the gender field of M and one that counts if the records contain a value in the gender field of F. We use the following expressions to do this:
When we preview the report, we will now see the results, that give us a count of how many male employees and how many female employees are recorded in the database: