Count and group records

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Can you count and group records similar to the way it is
done on a report.

I want to Group all records by [DRIVER] and count the
number of records per [DRIVER]

Thank you
Steve
 
There is not a simple, efficient way to do this if you still want to be able
to enter/modify records.

One solution is to filter the form to show only one driver at a time. In the
Form Footer section, you can count the associated records with a text box
that has Control Source of:
=Count("*")

You could sort the form by driver (Use a query as its RecordSource), and
show the number of records for the currently selected driver in the Form
Footer with:
=DCount("*", "MyTable", "DriverID = " & Nz([Driver], 0)
or, if Driver is a Text field:
=DCount("*", "MyTable", "DriverID = """ & [Driver] & """")

You could put that text box on every row of the form, but that will make it
very slow.

The other alternative is to use a subquery in the query that is the Record
Source for your form, but that will make the results read-only.
 
Back
Top