Calculated Fields in Access Query

mrmarc

Board Regular
Joined
Feb 3, 2014
Messages
79
This works for me in Calculated Field Expression:
IIf([Grade]="N2",[NumberOfCases]*28,0)

But this does not:

IIf([Grade]="N2",[NumberOfCases]*28+[LoosePounds],0)

Both Fields "NumberOfCases" and "LoosePounds" are integers which can be Null.

Any Ideas?
 
Also guys I made a mistake, maybe this will help. This is a calculated field IN a TABLE not a query. Sorry about that.
Here is some advice. Do not use Calculated Fields in a Table! I know it is a new feature, but that doesn't necessarily mean it is a good idea.
Most other larger database programs like SQL and Oracle do not allow this, so if you ever needed to convert/upgrade your database, this will cause issues!

Also, I can see very little reason for the need for this. This can all be done in a query (and probably should be done in a query). Seeing as how pretty much anything you can use a Table for in Access, you can also use a Query for, I cannot think of any advantage to doing the calculation in the table instead of a query.

I have never done a calculation at the table level, but based on what you are seeing, Calculated Expressions at the Table level may have more limitations that doing it at the Query level.
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Here is some advice. Do not use Calculated Fields in a Table! I know it is a new feature, but that doesn't necessarily mean it is a good idea.
Most other larger database programs like SQL and Oracle do not allow this, so if you ever needed to convert/upgrade your database, this will cause issues!

Also, I can see very little reason for the need for this. This can all be done in a query (and probably should be done in a query). Seeing as how pretty much anything you can use a Table for in Access, you can also use a Query for, I cannot think of any advantage to doing the calculation in the table instead of a query.

I have never done a calculation at the table level, but based on what you are seeing, Calculated Expressions at the Table level may have more limitations that doing it at the Query level.

Thanks for the advice Joe! I'm going to switch everything over to a query then.
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,624
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top