MS Access Fix() Function: Get the Integer Part of a Number (Truncate)

Learn how to use the MS Access `Fix()` function to extract the integer portion of a number. This guide explains the key difference between `Fix()` and `Int()`, highlighting how `Fix()` truncates the decimal portion and rounds towards zero for both positive and negative numbers. Improve your understanding of number manipulation in Access with this clear explanation and examples.



Definition and Usage

The Fix() function in MS Access returns the integer portion of a number. It's similar to the Int() function, but it handles negative numbers differently. While Int() rounds negative numbers *down* to the nearest integer, Fix() simply removes the decimal part, effectively rounding towards zero.

Syntax

Syntax

Fix(number)
            

Parameter Values

Parameter Description
number Required. A numeric value.

Examples

Example 1: Extracting the Integer Part of a Number

This example shows how to get the integer part of 756.43 using the Fix() function.

SQL Query

SELECT Fix(756.43) AS FixNum;
            
Output

FixNum
-------
756
            

Example 2: Applying Fix() to a Column

This example applies the Fix() function to the "Price" column in a "Products" table. This would return the integer portion of each price in the table.

SQL Query

SELECT Fix(Price) AS FixNum FROM Products;
            
Output

(The output will depend on the data in your "Products" table.  Each row will show the integer part of the corresponding "Price".)
            

Technical Details

The Fix() function is available in MS Access 2000 and later.