The list outlined here is designed to provide a solid reference to the functions that are most relevant to the realm of data analysis. Several of these functions have been covered in detail throughout the chapters in this book.
You can learn more about the functions that have not been covered here by using the Access help system.
Asc is a conversion function used to convert a string to its Ascii code. For example, Asc("A") would return 65 because 65 is the Ascii code for the uppercase letter A. If you pass a whole word to the Asc function, it will only return the Ascii code for the first letter of the word. | |
Syntax | |
| |
Argument | |
| This is the string you are evaluating. If the string you are passing to the function contains no characters, the function will fail and produce a runtime error. |
The Choose function is a program flow function that allows you to return a value from a list of choices based on a given position. For instance: Choose(3, "Microsoft", "Access", "Data", "Analysis") would return "Data" This is because word "Data" is in the third position in the list of values. | |
Syntax | |
| |
Arguments | |
| This is the numeric expression or field that results in a value between 1 and the number of available choices. If this argument's value is less than 1 or greater than the number of choices in the function, a Null value will be returned. |
List of Values Separated by Commas (required) | This is a variant expression that contains a list of one or more values. |
Chr is a conversion function used to convert an Ascii code to a string. For example, Chr(65) would return "A". | |
Syntax | |
| |
Arguments | |
| This is the number value that represents an Ascii character code. If the number you are passing to the function is not a valid Ascii character code, the function will fail and produce a runtime error. |
The Date function returns today's date based on your PC's current system date. The Date function is key to performing any analysis that involves a time comparison in relation to today's date. There are no required arguments for this function; to use it, simply enter: Date(). |
The DateAdd function returns a date to which a specified interval has been added. In other words, the DateAdd function allows you calculate a date by adding 30 days to it, subtracting 3 weeks from it, adding 4 months to it, or so on. For example:
| |
Syntax | |
| |
Arguments | |
| This is the interval of time that you want to use. The intervals available are:
|
| This is the number of intervals to add. A positive number will return a date in the future, while a negative number will return a date in the past. |
| This is the date value with which you are working. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The DateValue function allows you to convert any string or expression that represents a valid date, time, or both into a date value. For Example, DateValue("October 31, 2004") would return 10/31/2004. | |
Syntax | |
| |
Arguments | |
| Any string or valid expression that can represent a valid date, time, or both |
Day is a conversion function that converts a valid date to a number from 1 to 31, representing the day of the month for a given date. For example, Day(#5/16/1972#) would return 16. | |
Syntax | |
| |
Arguments | |
| This is any value that can represent a valid date. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
Exp is a math function that raises the base of natural logarithm's (2.718282) number to a power you specify. | |
Syntax | |
| |
Arguments | |
| This is the numeric expression used as the power to raise 2.718282. |
The FormatDateTime function is a conversion function that converts an expression to a date or time. | |
Syntax | |
| |
Arguments | |
| This is the date/time expression you want to convert. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
| This is the format code specifying the date/time format you would like to use. The settings for this argument are as follows:
|
Hour is a conversion function that converts a valid time to a number from 0 to 23, representing the hour of the day. For example, Hour(#9:30:00 PM#) would return 21. | |
Syntax | |
| |
Arguments | |
| This is any combination of values that can represent valid time. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
InStr is a text function that searches for a specified string in another string and returns its position number. For example: InStr("Alexander, Mike","x") would return 4 because the "x" is character number 4 in this string. | |
Syntax | |
| |
Arguments | |
| This is the character number to start the search; default is 1. |
| This is the string to be searched. |
| This is the string to search for. |
| This specifies the type of string comparison. |
Additional Remarks | |
The Compare argument can have the following values: | |
−1 | Performs a comparison using the setting of the Option Compare statement |
0 | Performs a binary comparison |
1 | Performs a textual comparison |
2 | (Microsoft Access only) Performs a comparison based on information in your database |
IPmt is a financial function that allows you to calculate the interest paid within a specified period during the life of an annuity. An annuity is a series of fixed cash payments normally made against a loan over a period of time. | |
Syntax | |
| |
Arguments | |
| This is the average interest rate per period. |
| This is the specified payment period in question. |
| This is the total number of payment periods in the annuity. |
| This is the present value of future payments. |
| This is the future value or final balance on a loan or an investment upon making the last payment. If omitted, 0 is assumed. |
| This argument specifies when payments are due. A value of 0 means that payments are due at the end of the payment period, while a value of 1 means that payments are due at the beginning of the payment period. If omitted, 0 is assumed. |
IsError is an inspection function that determines if an expression evaluates as an error. This function returns a True or False answer. | |
Syntax | |
| |
Arguments | |
| This is any value or expression. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
IsNumeric is an inspection function that determines whether an expression evaluates as a numeric value. This function returns a True or False answer. | |
Syntax | |
| |
Arguments | |
| This is any value or expression. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The LCase function converts a string to lowercase letters. | |
Syntax | |
| |
Arguments | |
| This is the string to be converted. In a query environment, you can use the name of a field to specify that you are converting all the row values of that field. |
The Len function returns a number identifying the number of characters in a given string. This function is quite useful when you need to dynamically determine the length of a string. For instance, Len("Alexander") would return 9. | |
Syntax | |
| |
Arguments | |
| This is the string or variable to be evaluated. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The Log function is a math function that calculates the natural logarithm of a number. | |
Syntax | |
| |
Arguments | |
| This is the numeric expression that is to be evaluated; must be greater than zero. |
The Minute function converts a valid time to a number from 0 to 59, representing the minute of the hour. For example, Minute(#9:30:00 PM#) would return 30. | |
Syntax | |
| |
Arguments | |
| This is any combination of values that can represent valid time. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field |
The Month function converts a valid date to a number from 1 to 12, representing the month for a given date. For example, Month(#5/16/1972#) would return 5. | |
Syntax | |
| |
Arguments | |
| This is any value that can represent a valid date. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The MonthName function converts a numeric month designation (1 to 12) to a month name. For instance, MonthName(8) would return August. Values less than 1 or greater than 12 will cause an error. | |
Syntax | |
| |
Arguments | |
| This is a number from 1 to 12 that represents a month. 1 represents January, 2 represents February, and so on. |
| This specifies whether the month is abbreviated or not. If this argument is omitted, the month is not abbreviated. Enter 1 to return abbreviated months. |
The NPer function is a financial function that specifies the number of periods for an annuity based on periodic, fixed payments at a fixed interest rate. An annuity is a series of fixed cash payments normally made against a loan over a period of time. | |
Syntax | |
| |
Arguments | |
| This is the stated interest rate per period. |
| This is the payment amount, usually consisting of principal and interest. |
| This is the present value of future payments and receipts. |
| This is the future value or final balance on a loan or an investment upon making the last payment. If omitted, 0 is assumed. |
| This argument specifies when payments are due. A value of 0 means that payments are due at the end of the payment period, while a value of 1 means that payments are due at the beginning of the payment period. If omitted, 0 is assumed. |
The NZ function allows you to tell Access to recognize Null values as another value, preventing your null values from propagating through an expression. | |
Syntax | |
| |
Arguments | |
| This is the data you are working with. |
| This is the value you want returned if the Variant is null. |
Partition is a database function that identifies the particular range in which a number falls and returns a string describing that range. This function is useful when you need to create a quick and easy frequency distribution. | |
Syntax | |
| |
Arguments | |
| This is the number you are evaluating. In a query environment, you typically use the name of a field to specify that you are evaluating all the row values of that field. |
| This is a whole number that is to be the start of the overall range of numbers. Note that this number cannot be less than zero. |
| This is a whole number that is to be the end of the overall range of numbers. Note that this number cannot be equal to or less than the Range Start. |
| This is a whole number that is to be the span of each range in the series from Range Start to Range Stop. Note that this number cannot be less than one. |
PV is a financial function that allows you to calculate an annuity's present value. An annuity is a series of fixed cash payments normally made against a loan over a period of time. | |
Syntax | |
| |
Arguments | |
This is the average interest rate per period. | |
| This is the total number of payment periods in the annuity. |
| This is the payment amount, usually consisting of principal and interest. |
| This is the future value or final balance on a loan or an investment upon making the last payment. If omitted, 0 is assumed. |
| This argument specifies when payments are due. A value of 0 means that payments are due at the end of the payment period, while a value of 1 means that payments are due at the beginning of the payment period. If omitted, 0 is assumed. |
Rnd is a math function that generates and returns a random number that is greater than or equal to 0 but less than 1. | |
Syntax | |
| |
Arguments | |
| This numeric expression determines how the random number is generated. |
Additional Remarks | |
If the Number argument is omitted from the function | The next random number in the sequence is generated. |
If the Number argument is less than zero | The same number is generated every time. |
If the Number argument is greater than zero | The next random number in the sequence is generated. |
If the Number argument equals zero | The most recently generated number is returned. |
The Second function converts a valid time to a number from 0 to 59, representing the seconds of the minute. For example, Second(#9:00:35 PM#) would return 35. | |
Syntax | |
| |
Arguments | |
| This is any combination of values that can represent valid time. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
Sgn is a math function that returns an integer code associated with the sign of a given number. If the given number is less than zero (has a negative designation), the Sgn function returns −1. If the given number equals zero, the Sgn function returns 0. If the given number is greater than zero (has a positive designation), the Sgn function returns 1. | |
Syntax | |
| |
Arguments | |
| This is the numeric expression you are evaluating. |
SLN is a financial function that calculates the straight-line depreciation of an asset for one period. | |
Syntax | |
| |
Arguments | |
| This is the initial cost of the asset; must be a positive number. |
| This is the value of the asset at the end of its useful life; must be a positive number. |
| This is the length of the useful life of the asset. |
The Space function allows you to create a string with a specified number of spaces to a string. This function comes in handy when you need to clear data in fixed-length strings. For example, you can use the Space function within an expression such as Space(5) & "Access". This would change the string "Access" to "Access". | |
Syntax | |
| |
Arguments | |
| This is the number of spaces to include in the string. |
Str is a conversion function that converts a numeric value into a string representation of the number. For instance, Str(2304) would return "2304". Note that positive numbers converted with Str always have a leading space to represent the positive sign. Negative numbers have a negative sign as the leading character. | |
Syntax | |
| |
Arguments | |
| This is the number you want to convert to a string. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The String function allows you to return a character string of a certain length. For example, String(4, "0") would return "0000". | |
Syntax | |
| |
Arguments | |
| This is the number of times you want to repeat the StringCharacter. |
| This is the character that will make up your string. If you enter a series of characters, only the first character will be used. |
Switch is a program flow function that allows you to evaluate a list of expressions and return the value associated with the expression determined to be true. To use the Switch function, you must provide a minimum of one expression and one value. | |
Syntax | |
| |
Arguments | |
| This is the expression you want to evaluate. |
| This is the value to return if the expression is true. |
Additional Remarks | |
To evaluate multiple expressions, simply add another Expression and Value to the function. For example: Switch(Expression1, Value 1, Expression2, Value2, Expression3, Value3). | |
When the Switch function is executed, each expression is evaluated. If an expression evaluates to true, the value that follows that expression is returned. If more than one expression is true, the value for the first true expression is returned. |
Tan is a math function that allows you to calculate the tangent of an angle. | |
Syntax | |
| |
Arguments | |
| This is any numeric expression that expresses an angle in radians. |
The Time function returns today's time based on your PC's current system time. This function is ideal for time stamping transactions. There are no required arguments for this function; to use it, simply enter: Time(). |
The TimeValue function converts a string representation of a time to an actual time value. For instance, TimeValue("4:20:37 PM") would return 4:20:37 PM. The function also works on a 24-hour clock. | |
Syntax | |
| |
Arguments | |
| This is any string or expression that represents a time ranging from 0:00:00 and 23:59:59. The string can be either a 12-hour clock entry, or a 24-hour clock entry. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
TypeName is an inspection function that returns the type information of a variable. For instance, TypeName("Michael") would return "String". | |
Syntax | |
| |
Arguments | |
| This is the variable you want to evaluate. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
Additional Remarks | |
The string returned by the | |
| An object whose type is objecttype |
A byte value | |
An Integer type | |
| A long integer type |
A single-precision floating-point number | |
A double-precision floating-point number | |
| A currency value |
A decimal value | |
| A date value |
| A string type |
| A boolean value |
| An error value |
| Variable has not been initialized |
| Variable contains no valid data; a Null value |
| An object |
| An object whose type is unknown |
| An object variable that does not refer to an object |
Val is a conversion function that extracts the numeric part of a string. For instance, Val("5400 Legacy Drive") would return 5400. One caveat to the Val function is that it stops reading the string as soon as it hits a textual character. Therefore, the number you are extracting needs to be at the beginning of the string. | |
Syntax | |
| |
Arguments | |
| This is the string you want to evaluate. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
The WeekdayName function converts a numeric weekday designation (1 to 7) to a weekday name. For instance, WeekdayName(7) would return Saturday. Values less than 1 or greater than 7 will cause an error. | |
Syntax | |
| |
Arguments | |
| This is a number from 1 to 7 that represents a weekday. 1 represents Sunday, 2 represents Monday, and so on. |
| This specifies whether the weekday is abbreviated or not. If this argument is omitted, the weekday is not abbreviated. Enter 1 for this argument to return abbreviated weekdays. |
| This specifies which day you want to count as the first day of the week. Enter 1 in this argument to make the first day Sunday, 2 for Monday, 3 for Tuesday, and so on. If this argument is omitted, the first day is a Sunday by default. |
The Year function returns a whole number representing the year for a given date. For example, Year(#5/16/1972#) would return 1972. | |
Syntax | |
| |
Arguments | |
| This is any value that can represent a valid date. In a query environment, you can use the name of a field to specify that you are evaluating all the row values of that field. |
3.145.95.7