MS Access Asc() Function
The Asc()
function in MS Access gets the ASCII (American Standard Code for Information Interchange) value of a character. ASCII is a numerical representation of characters, where each character (like 'A', 'b', '!', etc.) has a unique numerical code.
Asc(): Definition and Usage
Asc()
is useful when you need to work with the underlying numerical representation of characters. This might be necessary for character-by-character comparisons, data validation, or specialized text processing within your MS Access applications. The function returns the ASCII value of only the very first character in the input string; any other characters are ignored.
Syntax
Syntax
Asc(character)
Parameter Values
Parameter | Description |
---|---|
character |
The character (or string—only the first character is used) for which you want the ASCII value. This is required. |
Example
Getting the ASCII Value of a Character
This example retrieves the ASCII value of the first character in the 'CustomerName' column from the 'Customers' table. (This assumes that a table named 'Customers' exists with a 'CustomerName' column.)
Syntax
SELECT Asc(CustomerName) AS NumCodeOfFirstChar
FROM Customers;
Output
NumCodeOfFirstChar
------------------
(The ASCII value of the first character of each CustomerName will be shown here.)