Dfirst

Return the first value from a specified set of records.

Syntax
      DFirst ( expression, domain, [criteria] )

      =DFirst("[Field]", "Table", "[Field] = 'MyValue'")

Key
   expression The field to return.

   domain     The set of records, a table or a query name.

   criteria   Equivalent to an (optional) WHERE clause.
              Any field that is included in criteria must
              also be a field in domain.

To return the first or last record in a set of records (a domain), create a query sorted as either ascending or descending and set the TopValues property to 1.

The DFirst() function may be used in VBA or in an SQL query.

Example

Dfirst("OrderID", "qryOrders", "SupplierID = 64 ")

This is equivalent to:
SELECT Dfirst([qryOrders].OrderID)
FROM [qryOrders]
WHERE (([qryOrders].SupplierID)=64);

“If you are planning for a year, sow rice; if you are planning for a decade, plant trees; if you are planning for a lifetime, educate people” ~ Chinese Proverb

Related:

First (SQL) - Return the first value from a query.


© Copyright SS64.com 1999-2013
Some rights reserved