General
Here are some viable options that may help put you on the right track
I hope these little snippets help
DCount counts the number of records that meet criteria specified in the criteria:
DCount("FieldToCount","Table or Query Name","Criteria")
Examples: The first example counts the number of records in the customer table that have a conatact name greater than S. The second counts contact names less than S and the third counts contact names that have S as the first letter.
DCount("[ContactName]","Customers","[ContactName] > 'S'")
DCount("[ContactName]","Customers","[ContactName] < 'S'")
DCount("[ContactName]","Customers","[ContactName] Like 'S*'")
DSum sums the field of records that meet criteria specified in the criteria:
DSum("FieldToSum or Expr","Table or Query Name","Criteria")
Examples: The first example sums all the InvoiceTotals in the CustomerInvoices Table. The second example sums all the InvoiceTotals in the CustomerInvoices Table that have an invoice date greater than 21st Febuary 2000. The third example shows how you can perform a calculated sum, this particular one takes the InvoiceSubTotal multiplies by CityTaxCode and then sums all those for each record.
DSum("[InvoiceTotal]","CustomersInvoices")
DSum("[InvoiceTotal]","CustomersInvoices","[InvoiceDate] > #21/1/2000#")
DSum("[InvoiceSubTotal] * [CityTaxCode]","CustomersInvoices")
DAvg gives the average of all records that meet criteria specified in the criteria:
DSum("FieldToAverage or Expr","Table or Query Name","Criteria")
Examples: The first example gives the average of all the InvoiceTotals in the CustomerInvoices Table. The second example gives the average of all the InvoiceTotals in the CustomerInvoices Table that have an invoice date greater than 21st Febuary 2000.
DAvg("[InvoiceTotal]","CustomersInvoices")
DAvg("[InvoiceTotal]","CustomersInvoices","[InvoiceDate] > #21/1/2000#")