DMin, DMax Functions (SQL Only)
See Also Example
Description
Return the minimum and maximum of a set of values in a specified set of records (domain
Syntax
DMin( expr, domain [, criteria] )
DMax( expr, domain [, criteria] )
Remarks
The DMin and DMax functions use the following arguments.
Argument Description
expr String expression identifying the field that contains the data you want to evaluate, or an expression that performs calculations using the data in that field. Operands in expr can include the name of a table field, or a Visual Basic function (which can be intrinsic but not a user-defined function or one of the other domain aggregate or SQL aggregate functions).
domain String expression identifying the records that constitute the domain. It can be a table name, a query name, or an SQL expression that returns data.
criteria Optional string expression used to restrict the range of data on which DMin and DMax are performed. For example, criteria could be the WHERE clause in an SQL expression (without the word WHERE). If criteria is omitted, DMin and DMax evaluate expr against the entire domain.
You can use DMin and DMax to return the lowest and highest value. If expr identifies numeric data, these functions return numeric values. If expr identifies non-numeric data, they return the string that is first or last alphabetically. If the criteria argument contains non-numeric text other than field names, you must enclose the text in single quotation marks. In the following example, Ship Country is the name of a field, and UK is a string literal.
X = DMin("[Freight]", "Orders", "[Ship Country] = 'UK'")
Y = DMax("[Freight]", "Orders", "[Ship Country] = 'UK'")
Z = DMax("[Freight]", "Orders", "[Ship Via] = 1")