Add 2 calculated fields

O

Orlando

Hi, I have a form and 2 subforms in both forms I have 1 calculated field
each, I need to add this 2 fields in 1 field in the principal form with I am
using this formula in the control source of the txtBox
=([fsubDailyPlan1].[T1Calories])+([fsubDailyPlan2].[T2Calories]) But I am
having an error, if somebody can help me I Would appreciated.

Thanks
 
A

Arvin Meyer [MVP]

You are trying to add the values of a subform in a main form text box, to do
that try:

=([Forms]![MainformName]![fsubDailyPlan1].Form![T1Calories])+([Forms]![MainformName]![fsubDailyPlan2].Form![T2Calories])
 
R

ruralguy via AccessMonster.com

Arvin,
Is there a problem with not using parens and using the abreviated syntax?

=[fsubDailyPlan1].Form![T1Calories]+[fsubDailyPlan2].Form![T2Calories]

You are trying to add the values of a subform in a main form text box, to do
that try:

=([Forms]![MainformName]![fsubDailyPlan1].Form![T1Calories])+([Forms]![MainformName]![fsubDailyPlan2].Form![T2Calories])
Hi, I have a form and 2 subforms in both forms I have 1 calculated field
each, I need to add this 2 fields in 1 field in the principal form with I
[quoted text clipped - 4 lines]
 
A

Arvin Meyer [MVP]

The parenthesis are completely unnecessary, except perhaps for clarity. I
prefer to use the full syntax whenever possible because there is no chance
for Access, or another programmer, to become confused. If you've ever
noticed all the extra parens and the specific [TableName].[FieldName] syntax
in SQL view of Access queries, it makes everything unambiguous. Most of the
parens and table names are unnecessary, but I find it usually easier to
quickly read the code when they are there.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ruralguy via AccessMonster.com said:
Arvin,
Is there a problem with not using parens and using the abreviated syntax?

=[fsubDailyPlan1].Form![T1Calories]+[fsubDailyPlan2].Form![T2Calories]

You are trying to add the values of a subform in a main form text box, to
do
that try:

=([Forms]![MainformName]![fsubDailyPlan1].Form![T1Calories])+([Forms]![MainformName]![fsubDailyPlan2].Form![T2Calories])
Hi, I have a form and 2 subforms in both forms I have 1 calculated field
each, I need to add this 2 fields in 1 field in the principal form with
I
[quoted text clipped - 4 lines]
 
R

ruralguy via AccessMonster.com

Thanks for the explaination Arvin. It is what I thought but wanted to make
sure I was not overlooking something important.
The parenthesis are completely unnecessary, except perhaps for clarity. I
prefer to use the full syntax whenever possible because there is no chance
for Access, or another programmer, to become confused. If you've ever
noticed all the extra parens and the specific [TableName].[FieldName] syntax
in SQL view of Access queries, it makes everything unambiguous. Most of the
parens and table names are unnecessary, but I find it usually easier to
quickly read the code when they are there.
Arvin,
Is there a problem with not using parens and using the abreviated syntax?
[quoted text clipped - 12 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top