Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

Returns the integer portion of a number.

Syntax

Int ( number )

Fix( number )

The required numberargument is a Double or any valid numeric expression. If number contains Null, Null is returned.

Remarks

Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number))

Query examples

Expression

Results

SELECT Int([Discount]) AS Expr1 FROM ProductSales;

Removes the fractional part of all the values in the field "Discount" and returns the resulting integer values. For negative fractions "Int" returns the first negative integer less than or equal to number. For example, for discount value "-223.20", the integer returned will be -224.00.

SELECT Fix([Discount]) AS Expr1 FROM ProductSales;

Removes the fractional part of all the values in the field "Discount" and returns the resulting integer values. For negative fractions "Fix" returns the first negative integer greater than or equal to number. For example, for discount value "-223.20", the integer returned will be -223.00.

VBA Example

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

This example illustrates how the Int and Fix functions return integer portions of numbers. In the case of a negative number argument, the Int function returns the first negative integer less than or equal to the number; the Fix function returns the first negative integer greater than or equal to the number.

Dim MyNumberMyNumber = Int(99.8)    ' Returns 99.MyNumber = Fix(99.2)    ' Returns 99.MyNumber = Int(-99.8)    ' Returns -100.MyNumber = Fix(-99.8)    ' Returns -99.MyNumber = Int(-99.2)    ' Returns -100.MyNumber = Fix(-99.2)    ' Returns -99.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.