Count rows in a query (ADP)

Microsoft Office Access 2003

  • The total number of rows, for example, a count of all the books in a titles query.
  • The number of rows that meet a specific condition, for example, the number of books by one publisher in a titles query.
  • The number of values in a particular column. When you count values in a column, nulls are not included in the count.
  • ShowCount all rows

    1. In the Database window, click Queries Button image under Objects, and then click New on the database window toolbar.
    2. Add the table, view, or function you want to summarize in the Diagram pane.
    3. Right-click the background of the Diagram pane, then choose Group By from the shortcut menu. The Query Designer adds a Group By column to the grid in the Grid pane.
    4. Select * (All Columns) in the rectangle representing the table, view, or function.

      The Query Designer automatically fills the term Count into the Group By column in the Grid pane and assigns a column alias to the column you are summarizing. You can replace this automatically generated alias with a more meaningful one.

    ShowCount all the rows that meet a condition

    1. In the Database window, click Queries Button image under Objects, and then click New on the database window toolbar.
    2. Add the table, view, or function you want to summarize in the Diagram pane.
    3. Right-click the background of the Diagram pane, then choose Group By from the shortcut menu. The Query Designer adds a Group By column to the grid in the Grid pane.
    4. Select * (All Columns) in the rectangle representing the table, view, or function.

      The Query Designer automatically fills the term Count into the Group By column in the Grid pane and assigns a column alias to the column you are summarizing.

    5. Add the data column that you want to search, and then clear the check box in the Output column.

      The Query Designer automatically fills the term Group By into the Group By column of the grid.

    6. Change Group By in the Group By column to Where.
    7. In the Criteria column for the data column to search, enter the search condition.

    ShowCount the values in a column

    1. In the Database window, click Queries Button image under Objects, and then click New on the database window toolbar.
    2. Add the table, view, or function you want to summarize in the Diagram pane.
    3. Right-click the background of the Diagram pane, then choose Group By from the shortcut menu. The Query Designer adds a Group By column to the grid in the Grid pane.
    4. Add the column that you want to count to the Grid pane.

      The Query Designer automatically fills the term Group By into the Group By column of the grid.

    5. Change Group By in the Group By column to Count.

      Note   To count only unique values, choose Count Distinct.