Open In App

Chr() and Asc() Function in MS Access

Improve
Improve
Like Article
Like
Save
Share
Report

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 –

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


Last Updated : 21 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads