Chr() and Asc() Function in MS Access
1. CHR() Function :
The Chr() function returns the character for the given ASCII number code. The Chr function takes an integer as a parameter and returns the respective character. It works opposite to ASC() function.
Syntax –
Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course by GeeksforGeeks.
Chr(ASCII number code)
Parameter – Required; An integer.
Return – A character.
Example –
SELECT Chr(75) AS NumberCodeToCharacter;
Output –
| NumberCodeToCharacter |
|---|
| K |
2. ASC() Function :
The ASC() function returns the ASCII value of the character. If more than one character is passed in the function then it will return the ASCII value of the first character otherwise ASCII value of the specified character.
Syntax –
ASC(Character)
Parameter – Required; A character or a string.
Return – ASCII value; An Integer value.
Example –
Table – Student
| STUDENTNAME | COURSE |
|---|---|
| GFG_USER1 | OOPS |
| XYZ | DSA SELF PACED |
SELECT STUDENT, Asc(STUDENTNAME) AS NumCodeOfFirstChar FROM STUDENT;
Output –
| STUDENT | NumCodeOfFirstChar |
|---|---|
| GFG_USER1 | 107 |
| XYZ | 130 |


