On TV.com: 10 characters that need to be killed off

Add a calculated field to your Access form

Tags: Microsoft Office, Databases, Mary Ann Richardson, calculated field, Microsoft Access, Total Purchase Price, Microsoft Office Suite Access Tips Newsletter

  • Save
  • Print
  • Recommend
  • 6

Takeaway: Need to add a calculated field to an Access form? It's easy, and you can do it on the fly. Just add a new text box control with the appropriate formula as its control source.

If you are building an Access form based on a query and notice you will need to add a calculated field, you don't need to redesign your query -- just add the calculated field to your form. For example, say you are creating a form based on the Orders query, which consists of fields from the Orders and Order Details tables. You notice the query does not have a calculated field for the Total Purchase Price (Quantity*UnitPrice), which you want to appear on your form. Follow these steps to add a field for this calculation:

  1. Open the form based on the Orders query in Design Mode.
  2. Click the text box tool in the Database Toolbox.
  3. Click and drag in the form where you want to display the calculated field.
  4. Click and drag to select the Text Box Label and enter Total Purchase Price.
  5. Right-click the Unbound text box.
  6. Click Properties.
  7. Under the Data tab, click in the Control Source text box and enter the following formula:
    =IIf(IsNull([Quantity]*[UnitPrice]),0,([Quantity]*[UnitPrice]))

As you enter orders into the form, the Total Purchase Price will display in the calculated field.

Miss a tip?

Check out the Microsoft Access archive, and catch up on our most recent Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

  • Save
  • Print
  • Recommend
  • 6

Print/View all Posts Comments on this article

What about multiple items? julietausch@... | 04/26/07
did you ever find an answer? d_benesh@... | 11/02/08
See if this helps Tink! | 11/03/08
RE: Add a calculated field to your Access form dmuyangwa2006@... | 09/20/07

What do you think?

White Papers, Webcasts, and Downloads

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

SmartPlanet

advertisement
Click Here