# Hex() and Oct() Function Function in MS Access

1. Hex() Function :
Hex() Function in MS Access is used to returns a String representing the hexadecimal value of a number.

Syntax :

```Hex(number)
```

Parameter : This method accepts one parameter as mentioned above and described below :

• number : It is is any valid numeric expression or string expression.

Returns : If the number is null it returns null, if the number is Empty then it returns Zero (0). Otherwise it returns a String representing the hexadecimal value of a number.

Note : If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

Example-1 : Hexadecimal representation of 2.

```SELECT Hex(2) AS HexNumber;
```

Output :

HexNumber
2

Example-2 : Hexadecimal representation of 13.

```SELECT Hex(13) AS HexNumber;
```

Output :

HexNumber
D

Example-3 : Hexadecimal representation of 1134.80.

```SELECT Hex(1134.80) AS HexNumber;
```

Output :

HexNumber
46F

2. Oct() Function :
Oct() Function in MS Access is used to returns a String representing the octal value of a number.

Syntax :

```Oct(number)
```

Parameter : This method accepts one parameter as mentioned above and described below :

• number : It is is any valid numeric expression or string expression.

Returns : If the number is null it returns null, if the number is Empty then it returns Zero (0).Otherwise it returns a String representing the octal value of a number.

Note : If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

Example-1 : Octal representation of 7.

```SELECT Oct(7) AS OctNumber;
```

Output :

OctNumber
7

Example-2 : Octal representation of 111.45.

```SELECT Oct(111.45) AS OctNumber;
```

Output :

OctNumber
157
My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.