How to Add a Variable Field to Access Query

Save

One of the most powerful features of Microsoft Access is the ability to add calculated fields to a query. These variable fields take data from two or more fields within the database's tables, then manipulate that data to produce the needed results. This eliminates the need to include calculations and extra fields within the tables themselves, allowing the database to load more quickly and boost overall performance. Database developers could, for instance, include a variable field that multiplies the number of units ordered by the unit price to get the total cost of an order.

  • Log on to your computer and open Microsoft Access. Open the database with which you want to work.

  • Click the ribbon and choose the "Create" tab. Click the "Query Design" button to start building the query.

  • Highlight each table you want to include in the query. You can base your query on a single table, or on two or more tables. Click "Add" to add each table, then "Close" when you are finished adding tables.

  • Double-click each field you want to include in the table. Note the names of the fields you want to use to build the variable field.

  • Move your cursor to the right of the last field selected. Place the cursor in the "Field" section of the form.

  • Type a name for your variable field, followed by a colon, then the names of the fields you want to manipulate to get your result. For instance, to create a variable field called "Total Order" that multiplies the "UnitCost" field by the "NumberofUnits field," you would type "Total Cost: [UnitCost]*[NumberofUnits]." Each field name must be enclosed within brackets.

  • Click the "Quick Access" toolbar and choose "Save" to save the query. Give the query a distinctive name, then click the "Run" button to see the results. The "Run" button is the red exclamation point along the top.

References

  • Photo Credit Jorg Greuel/Photodisc/Getty Images
Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!