Home Privacy Policy Feedback Link to us Site Map

Access: DLast Function


In Access, the DLast function returns the last value from a specified set of records (or domain).

The syntax for the DLast function is:

DLast ( expression, domain, [criteria]

expression is the field from which you want the last value.

domain is the set of records. This can be a table or a query name.

criteria is optional. It is the WHERE clause to apply to the domain.


For example:

Let's take a look at a simple example:

DLast("UnitPrice", "Order Details", "OrderID = 10248")

In this example, you would retrieve the last UnitPrice value in the Order Details table where the OrderID is 10248.


VBA Code

The DLast function can be used in VBA code. For example:

Dim LTotal As Currency

LTotal = DLast("UnitPrice", "Order Details", "OrderID = 10248")

In this example, the variable called LTotal would now contain the last UnitPrice from the Order Details table where the OrderID is 10248.


SQL/Queries

You can also use the DLast function in a query.