totn Access Functions

MS Access: Last Function

This MSAccess tutorial explains how to use the Access Last function with syntax and examples.

Description

The Microsoft Access Last function returns the last value from the result set of a query.

Syntax

The syntax for the Last function in MS Access is:

Last ( expression )

Parameters or Arguments

expression
The value that you'd like to return from the result set. The Last function only returns the last value in the result set.

Returns

The Last function returns any datatype such as a string, numeric, date, etc.

Applies To

The Last function can be used in the following versions of Microsoft Access:

  • Access 2019, Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000

Example

Let's look at how to use the Last function in MS Access:

Last (SupplierID)

In this example, the Last function would return the last SupplierID value.

Example in SQL/Queries

You can use the Last function in a query in Microsoft Access.

For example:

Microsoft Access

In this query, we have used the Last function as follows:

Expr1: Last([SupplierID])

This query will return the last SupplierID and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.

For example:

LastSupplier: Last([SupplierID])

The results would now be displayed in a column called LastSupplier.