[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access -- Can't create calculated field

Posted on 2014-04-29
5
Medium Priority
?
5,358 Views
Last Modified: 2014-05-01
What am I doing wrong?

Screen shot with the error message
0
Comment
Question by:rrhandle8
  • 2
  • 2
5 Comments
 
LVL 40
ID: 40031359
You cannot enter a calculated expression dependent on other  fields when defining the default value. And there is a very good reason for that. The default value is created at the same time as the records. There are no values in the other fields at that time.

There is no need to store the Profit in the table, it just takes useless space since you can recalculate it in queries, forms and reports that would need it. This is where your expression should be used.
0
 

Author Comment

by:rrhandle8
ID: 40032140
So how does one create a calculated field?  I am aware of the extra space it will take up, and seldom use calculated fields.  In this case it will save the user a lot of time which in my opinion is more precious than extra space in the database.
0
 
LVL 40
ID: 40032344
As I told you, calculated fields are used in queries, forms and reports.

The easiest way to go is to create a query that has all the fields of the table, plus a calculated field. To do that, you simply type your expression instead of the fieldname on the first cell of an empty column in the Query Designer.

Use that query instead of the table in your forms and reports when you need the profit.

A query is like a temporary table and can be used almost anywhere you use a table. And that one will contain a temporary field that exists only in that temporary table.

You also gain an extra feature: calculated fields in a query are read-only, so you are automatically sure that a user won't go in and manually change the value of the profit field. It's usually a good idea however to change the format of these calculated fields in forms so that they do not show the same way as editable fields. Simply setting the background of the TextBox to grey is usually a good indication to the user that he cannot edit that field.
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 1200 total points
ID: 40036072
Something like this is what @JamesBurger has in mind.
MS's rules and methods for creating calculated fields in Access 2010 are here:
http://office.microsoft.com/en-001/access-help/add-a-calculated-field-to-a-table-HA101820564.aspx

I don't think you can do this in Access 2003, and maybe not in Access 2007.
You certainly cannot do it in the manner described in Access 2003 OR Access 2013
It seems to be an Access 2010 thing only and still a bad idea
http://allenbrowne.com/casu-14.html
Profit.mdb
0
 

Author Closing Comment

by:rrhandle8
ID: 40036088
That explains it.  The database I was using is a 2003 version, and I was trying to follow the rules for 2010.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question