Ms Access Gurus      

VBA Function Reference

Reference for VBA functions with Function name and un-abbreviation, Link to Microsoft Help, Return type, Category, and Syntax.

These functions work in Access, Excel, Word, PowerPoint, Visio, and other applications with VBA.

There are additional functions defined by Access that can be used in (some but not all) Access object expressions as well as VBA in Access such as Nz (Null-to-Zero).

Function Reference for VBA

Quick Jump

Goto the Very Top  

Index

Abs
Array
Asc
AscB
AscW
Atn
CallByName
Choose
Chr
ChrB
ChrW
Command
Cos
CreateObject
CurDir
CVErr
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day
DDB
Dir
DoEvents
Environ
EOF
Error
Exp
FileAttr
FileDateTime
FileLen
Filter
Fix
Format
Format$
FormatCurrency
FormatDateTime
FormatNumber
FormatPercent
FreeFile
FV
GetAllSettings
GetAttr
GetObject
GetSetting
Hex
Hour
IIf
IMEStatus
Input
InputBox
InStr
InStrRev
Int
IPmt
IRR
IsArray
IsDate
IsEmpty
IsError
IsMissing
IsNull
IsNumeric
IsObject
Join
LBound
LCase
LCase$
Left
Len
LenB
Loc
LOF
Log
LTrim
LTrim$
MacID
Mid
Minute
MIRR
Month
MonthName
MsgBox
Now
NPer
NPV
Oct
Partition
Pmt
PPmt
PV
QBColor
Rate
Replace
RGB
Right
Rnd
Round
RTrim
RTrim$
Second
Seek
Sgn
Shell
Sin
SLN
Space
Space$
Spc
Split
Sqr
Str
StrComp
StrConv
String
String$
StrReverse
Switch
SYD
Tab
Tan
Time
Timer
TimeSerial
TimeValue
Trim
Trim$
TypeName
UBound
UCase
Val
VarType
Weekday
WeekdayName
Year

Goto Top  

Reference

Microsoft Learn

Function Return Type, Category Syntax
A           Goto Top
Abs
Absolute value
Variant (Number) 
Math
Abs(number)
Array
Array
Variant 
Arrays
Array(arglist)
Asc
ASCII
Integer 
Conversion
Asc(string)
AscB
ASCII Byte
Byte 
Conversion
AscB(string)
AscW
ASCII Wide
Long Integer 
Conversion
AscW(string)
Atn
Arctangent
Double 
Math, Trig
Atn(number)
C           Goto Top
CallByName
Call By Name
 
Other
CallByName (object, procname, calltype [, args()] )
Choose
Choose
Variant 
Program Flow
Choose( index, choice-1 [, choice-2 [,... [, choice-n ]]] )
Chr
Character
String 
Conversion
Chr(charcode)
ChrB
Character Byte
Byte 
Conversion
ChrB(charcode)
ChrW
Character Wide
String 
Conversion
ChrW(charcode)
Command
Command
String 
Other
Command
Cos
Cosine
Double 
Math, Trig
Cos(number)
CreateObject
CreateObject
Object 
Other
CreateObject(class [, servername ])
CurDir
Current Directory
Variant (String) 
Other
CurDir [ (drive) ]
CVErr
Convert Value to Error
Variant 
Error Handling
CVErr(errornumber)
D           Goto Top
Date
Date
Date/Time 
Date/Time
Date [ () ]
DateAdd
Date Add
Variant (Date) 
Date/Time
DateAdd(interval, number, date)
DateDiff
Date Difference
Variant (Long) 
Date/Time
DateDiff(interval, date1, date2 [, firstdayofweek [ , firstweekofyear ]] )
DatePart
Date Part
Variant (Integer) 
Date/Time
DatePart(interval, date [, firstdayofweek [, firstweekofyear ]])
DateSerial
Date Serial
Variant (Date) 
Date/Time
DateSerial(year, month, day)
DateValue
DateValue
Variant (Date) 
Date/Time
DateValue(date)
Day
Day
Variant (Integer) 
Date/Time
Day(date)
DDB
double-declining balance
Double 
Financial
DDB(cost, salvage, life, period [, factor ])
Dir
Directory
String 
File
Dir [ (pathname [ , attributes ] ) ]
DoEvents
DoEvents
Byte 
System
DoEvents [ () ]
E           Goto Top
Environ
Environment
String 
System
Environ( { envstring | number } )
EOF
End of File
Boolean 
File
EOF(filenumber)
Error
Error
String 
Error Handling
Error [ (errornumber) ]
Exp
Exponent
Double 
Math
Exp(number)
F           Goto Top
FileAttr
File Attributes
Long Integer 
File
FileAttr(filenumber, returntype)
FileDateTime
File Date and Time
Variant (Date) 
File
FileDateTime(pathname)
FileLen
File Length
Long Integer 
File
FileLen(pathname)
Filter
Filter
Array (String) 
Arrays
Filter(sourcearray, match [ , include [, compare ]])
Fix
Fix Integer
Variant (Long) 
Conversion
Fix(number)
Format
Format
Variant (String) 
Conversion
Format(Expression [, Format ] [, FirstDayOfWeek ] [ , FirstWeekOfYear ])
Format$
Format (string)
String 
Conversion
Format$(Expression [, Format ] [, FirstDayOfWeek ] [ , FirstWeekOfYear ])
FormatCurrency
Format Currency
String 
Conversion
FormatCurrency(Expression [, NumDigitsAfterDecimal [, IncludeLeadingDigit [, UseParensForNegativeNumbers [, GroupDigits ]]]] )
FormatDateTime
Format DateTime
String 
Conversion
FormatDateTime(Date [ , NamedFormat ])
FormatNumber
Format Number
String 
Conversion
FormatNumber(Expression [, NumDigitsAfterDecimal [, IncludeLeadingDigit [, UseParensForNegativeNumbers [, GroupDigits ]]]] )
FormatPercent
Format Percent
String 
Conversion
FormatPercent(Expression [, NumDigitsAfterDecimal [, IncludeLeadingDigit [, UseParensForNegativeNumbers [, GroupDigits ]]]] )
FreeFile
Free File
Integer 
File
FreeFile [ (rangenumber) ]
FV
Future Value
Double 
Financial
FV(rate, nper, pmt [, pv [, type ]])
G           Goto Top
GetAllSettings
Get All Settings
Variant 
Registry
GetAllSettings(appname, section)
GetAttr
Get Attributes
Integer 
File
GetAttr(pathname)
GetObject
Get Object
Object 
Other
GetObject([ pathname ] [, class ])
GetSetting
Get Setting
Variant 
Registry
GetSetting(appname, section, key [, default ])
H           Goto Top
Hex
Hexadecimal
Variant (String) 
Conversion
Hex(number)
Hour
Hour
Variant (Integer) 
Date/Time
Hour(time)
I           Goto Top
IIf
Immediate If
Variant 
Program Flow
IIf(expr, truepart, falsepart)
IMEStatus
Input Method Editor (IME) mode
Integer 
Database
IMEStatus
Input
Input
String 
File
Input(number, [ # ]filenumber)
InputBox
Input Box
Integer 
Messages
InputBox(prompt, [ title ], [ default ], [ xpos ], [ ypos ], [ helpfile, context ])
InStr
In String
Variant (Long) 
Text
InStr( [ start, ] string1, string2 [, compare ])
InStrRev
In String Reverse
Variant (Long) 
Text
InstrRev(stringcheck, stringmatch [, start [, compare ]])
Int
Integer
Variant (Long) 
Conversion
Int(number)
IPmt
Interest Payment
Double 
Financial
IPmt(rate, per, nper, pv [, fv [, type ]])
IRR
Internal Rate of Return
Double 
Financial
IRR(values() [, guess ])
IsArray
Is Array
Boolean 
Arrays
IsArray(varname)
IsDate
Is Date
Boolean 
Inspection
IsDate(expression)
IsEmpty
Is Empty
Boolean 
Inspection
IsEmpty(expression)
IsError
Is Error
Boolean 
Error Handling
IsError(expression)
IsMissing
Is Missing
Boolean 
Inspection
IsMissing(argname)
IsNull
Is Null
Boolean 
Inspection
IsNull(expression)
IsNumeric
Is Numeric
Boolean 
Inspection
IsNumeric(expression)
IsObject
Is Object
Boolean 
Inspection
IsObject(identifier)
J           Goto Top
Join
Join to array
String 
Arrays
Join(sourcearray [, delimiter ])
L           Goto Top
LBound
Lower Bound
Long Integer 
Arrays
LBound(arrayname [, dimension ])
LCase
Lower Case
Variant (String) 
Text
LCase(string)
LCase$
Lower Case (string)
String 
Text
LCase$(string)
Left
Left
Variant (String) 
Text
Left(string, length)
Len
Length
Long Integer 
Text
Len(string | varname)
Loc
Location
Long Integer 
File
Loc(filenumber)
LOF
Length Of File
Long Integer 
File
LOF(filenumber)
Log
Log
Double 
Math
Log(number)
LTrim
Left Trim
Variant (String) 
Text
LTrim(string)
LTrim$
Left Trim (string)
String 
Text
LTrim$(string)
M           Goto Top
MacID
MacID
 
File
MacID(constant)
Mid
Middle
Variant (String) 
Text
Mid(string, start [, length ])
Minute
Minute
Variant (Integer) 
Date/Time
Minute(time)
MIRR
Modified Internal Rate of Return
Double 
Financial
MIRR(values( ), finance_rate, reinvest_rate)
Month
Month
Variant (Integer) 
Date/Time
Month(date)
MonthName
Month Name
String 
Date/Time
MonthName(month [ , abbreviate ])
MsgBox
Message Box
Integer 
Messages
MsgBox (prompt [, buttons ] [, title ] [, helpfile, context ])
N           Goto Top
Now
Now
Variant (Date) 
Date/Time
Now [ () ]
NPer
Number of Periods
Double 
Financial
NPer(rate, pmt, pv, [ fv, [ type ]])
NPV
Net Present Value
Double 
Financial
NPV(rate, values( ))
O           Goto Top
Oct
Octal
Variant (String) 
Conversion
Oct(number)
P           Goto Top
Partition
Partition
Variant (String) 
Database
Partition(number, start, stop, interval)
Pmt
Payment
Double 
Financial
Pmt(rate, nper, pv [, fv [, type ]])
PPmt
Principal Payment
Double 
Financial
PPmt(rate, per, nper, pv [, fv [, type ]])
PV
Present Value
Double 
Financial
PV(rate, nper, pmt [, fv [, type ]])
Q           Goto Top
QBColor
Quick Basic Color
Long Integer 
Color
QBColor(color)
R           Goto Top
Rate
Interest Rate
Double 
Financial
Rate(nper, pmt, pv [, fv [, type [, guess ]]])
Replace
Replace
String 
Text
Replace(expression, find, replace [, start [, count [ , compare ]]])
RGB
Red Green Blue
Long Integer 
Color
RGB(red, green, blue)
Right
Right
Variant (String) 
Text
Right(string, length)
Rnd
Random
Single 
Math
Rnd [ (Number) ]
Round
Round a number
Variant (Double) 
Math
Round(expression [, numdecimalplaces ])
RTrim
Right Trim
Variant (String) 
Text
RTrim(string)
RTrim$
Right Trim (string)
String 
Text
RTrim$(string)
S           Goto Top
Second
Second
Variant (Integer) 
Date/Time
Second(time)
Seek
Seek
Long Integer 
File
Seek(filenumber)
Sgn
Sgn
Variant (Integer) 
Math
Sgn(number)
Shell
Shell
Double 
System
Shell(pathname [, windowstyle ])
Sin
Sine
Double 
Math, Trig
Sin(number)
SLN
Straight-Line Depreciation
Double 
Financial
SLN(cost, salvage, life)
Space
Space
Variant (String) 
Text
Space(number)
Space$
Space (string)
String 
Text
Space$(number)
Spc
Spaces to insert
String 
Other
Spc(n)
Split
Split to array
Array (String) 
Arrays
Split(expression [, delimiter [, limit [, compare ]]])
Sqr
Square Root
Double 
Math
Sqr(number)
Str
convert String
Variant (String) 
Conversion
Str(number)
StrComp
String Compare
Variant (Integer) 
Text
StrComp(string1, string2 [, compare ])
StrConv
String Convert
Variant (String) 
Text
StrConv(string, conversion [, LCID ])
String
String with repeating character
Variant (String) 
Text
String(number, character)
String$
String (string)
String 
Text
String$(number, character)
StrReverse
String Reverse
String 
Text
StrReverse(expression)
Switch
Switch
Variant 
Program Flow
Switch( expr-1, value-1 [ , expr-2, value-2 [ , … expr-n, value-n ]] )
SYD
Sum-of-Years' Digits depreciation
Double 
Financial
SYD(cost, salvage, life, period)
T           Goto Top
Tab
position to Tab stop
Long Integer 
Other
Tab[ (n) ]
Tan
Tan
Double 
Math, Trig
Tan(number)
Time
Time
Variant (Date) 
Date/Time
Time [ () ]
Timer
Timer
Single 
Date/Time
Timer
TimeSerial
Time Serial
Variant (Date) 
Date/Time
TimeSerial(hour, minute, second)
TimeValue
Time Value
Variant (Date) 
Date/Time
TimeValue(time)
Trim
Trim
Variant (String) 
Text
Trim(string)
Trim$
Trim (string)
String 
Text
Trim$(string)
TypeName
Type Name of variable
String 
Inspection
TypeName(varname)
U           Goto Top
UBound
Upper Bound
Long Integer 
Arrays
UBound(arrayname [, dimension ])
UCase
Upper Case
Variant (String) 
Text
UCase(string)
V           Goto Top
Val
Value
Variant 
Conversion
Val(string)
VarType
Variable Type
Integer 
Inspection
VarType(varname)
W           Goto Top
Weekday
Weekday
Variant (Integer) 
Date/Time
Weekday(date [, firstdayofweek ])
WeekdayName
WeekdayName
String 
Date/Time
WeekdayName(weekday, abbreviate, firstdayofweek)
Y           Goto Top
Year
Year
Variant (Integer) 
Date/Time
Year(date)

Goto Top  

Back Story

I've longed for a reference just like this! So I made one.

This is generated from data in a database so as I find out more and update the database, this reference can be generated again.

Thanks to so many I've learned from. Special thanks to Adrian Bell and Geoff Griffith.

Goto Top  

Share with others

here's the link to copy:

https://msaccessgurus.com/VBA/VBA_FunctionReference.htm

Goto Top