The following will also give the value of 1 despite being so close to 2:
MsgBox Int(1.99)
Sqr
Sqrreturns the square root of a number. This example will result in the value 2:
MsgBox Sqr( 4 )
The following will result in the value 1.732:
MsgBox Sqr( 3 )
The following will give the value 10:
MsgBox Sqr( 100 )
Asc
Ascgives the ASCII (American Standard Code for Information Interchange) code for a given
character. Values are from 0 to 255. The following will give the value of 65:
MsgBox Asc("A")
The following will give the value of 105:
MsgBox Asc("i")
Note that this only works on the first character of the string:
Asc("richard")
This will give 114, as this is the ASCII code for “r”.
Chr
Chris the reverse ofAsc; it takes an ASCII code number and converts it to a character. This
example will give the string "A":
MsgBox Chr( 65 )
The following will give the string "i":
MsgBox Chr( 105 )
50 Microsoft Access 2010 VBA Macro Programming