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 can be used in VBA or in an SQL query.
Dfirst("OrderID", "qryOrders", "SupplierID = 64 ")
This is equivalent to:
“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
First (SQL) - Return the first value from a query.