totn Access Functions

MS Access: Fix Function

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

Description

The Microsoft Access Fix function returns the integer portion of a number.

Syntax

The syntax for the Fix function in MS Access is:

Fix ( expression )

Parameters or Arguments

expression
A numeric expression whose integer portion is returned.

Returns

The Fix function returns a numeric value.
If the expression is negative, the Fix function will return the first negative number that is greater than or equal to the expression.

Applies To

The Fix 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 Fix function in MS Access:

Fix (210.67)
Result: 210

Fix (2.98)
Result: 2

Fix (-2.98)
Result: -2

Example in VBA Code

The Fix function can be used in VBA code in Microsoft Access.

For example:

Dim LNumber As Double

LNumber = Fix (210.67)

In this example, the variable called LNumber would now contain the value of 210.

Example in SQL/Queries

You can also use the Fix function in a query in Microsoft Access.

For example:

Microsoft Access

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

Expr1: Fix([UnitPrice])

This query will return the integer portion of the UnitPrice field and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.

For example:

FixValue: Fix([UnitPrice])

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