0% found this document useful (0 votes)
30 views4 pages

MS Access - Calculated Expression

In MS Access, calculated expressions can be used to calculate and display data that is not stored in the database itself. Calculated expressions include elements like operators, constants, functions, and identifiers to produce a result. The document provides an example of creating a calculated field called "Subtotal" that multiplies the quantity of books ordered by the retail price of each book. It then creates another calculated field called "Tax" that multiplies the Subtotal by a 9% sales tax rate. These calculated fields allow querying and viewing calculated values without storing them in the database tables.

Uploaded by

Ramesh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
30 views4 pages

MS Access - Calculated Expression

In MS Access, calculated expressions can be used to calculate and display data that is not stored in the database itself. Calculated expressions include elements like operators, constants, functions, and identifiers to produce a result. The document provides an example of creating a calculated field called "Subtotal" that multiplies the quantity of books ordered by the retail price of each book. It then creates another calculated field called "Tax" that multiplies the Subtotal by a 9% sales tax rate. These calculated fields allow querying and viewing calculated values without storing them in the database tables.

Uploaded by

Ramesh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

MS Access - Calculated Expression

In MS Access, an expression is like a formula in Excel. This consists of a number of elements


that can be used alone or in a combination to produce a result. Expressions can include
operators’, constants, functions and identifiers.

Expressions can be used to perform a variety of tasks from retrieving the value of a
control or supplying criteria to a query to creating calculated controls and fields or
defining a group level for report.
In this chapter, we will be focusing on creating a very specific kind of expression called
a calculated expression. We will create several calculated fields that will calculate and
display data that is not stored anywhere within the database itself but calculated from
separate fields that are stored.
We now have a new Access database that contains more data to calculate.

Example
Let us try an example to understand this. We will be retrieving some information from a variety
of tables — tblCustomers, tblOrders, tblOrdersDetails and tblBooks and reviewing a variety
of fields.

Let us now run the query and you will see the following results.
We want a very simple calculation for a subtotal which will take the quantity of the books
ordered and multiply that by the retail price of the book. It is a good idea to begin every
expression or any expression with a name to call that field. Let us call this one subtotal.

The full expression (Subtotal: [tblOrdersDetails]![QTY]*[tblBooks]![RetailPrice]) includes


the table name, first tblOrdersDetails inside square brackets because that is where our quantity
field lives. Now an exclamation is telling Access to look inside that table for a field QTY and
multiply that by the retail price field in tblBooks.
Let us try to run your query and you will see at end the subtotal field.
Let us say we want to calculate our sales tax. In the query grid we will do in the exact same way
we did before and this time we will call the field simply Tax and Let us multiply Subtotal by nine
percent tax rate.

Let us run your query again and you will see the new Tax field in the end.

You might also like