Microsoft Office Tutorials and References

In Depth Information

**Going beyond Basic Arithmetic**

If a placeholder represents an optional argument, and you don’t plan to use

that argument, you can just delete the placeholder. If the placeholder

represents a required argument, though, you need to replace the placeholder with

valid data.

Using the help feature often when working with functions is very important.

We doubt that anybody has ever managed to memorize all the functions

because of the sheer number of them, all supporting so many different

arguments.

Nesting functions

You can
nest
functions, meaning that you can put a function inside another

function. Because Access always works from the innermost parentheses

outward, the inside function is always calculated first. The Date()

function, for example, always returns the current date. It requires no arguments.

The WeekDay() function accepts any date as an argument, meaning that its

syntax looks like the following:

WeekDay(
date
)

Because the Date() function always returns a date, you can use it as the

argument to the WeekDay() function. The expression turns out to be

WeekDay(Date())

Access returns a number from 1 to 7, indicating which day of the week

today is. (Day 1 is Sunday, Day 2 is Monday, and so on.) If the current date

is the 23rd, for example, and that day is a Tuesday, the WeekDay() function

returns 3.

Going beyond Basic Arithmetic

Near the start of this chapter, we talk about how you can use the +, –, *,

and / operators in expressions to perform simple arithmetic. As you know,

not all math is quite that simple. Some calculations require more than just

addition, subtraction, multiplication, and division.

Access offers many mathematical and financial functions to help with

morecomplex math. All these functions operate on numbers. The math functions

include Cos() (cosine), Tan() (tangent), and Atn() (arctangent), in case

you need to do a little trigonometry in your queries. The financial functions

include things such as IRR() (internal rate of return), Fv() (future value),

and Ddb() (double-declining balance depreciation). You’re unlikely to need

financial functions unless your work specifically requires those sorts of

calculations.