Calculated Field #Name error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform ('patient treatment subform') with entered data saved in
table 'patient treatments table'. Users enter numbers in fields
'pp_intensity', 'pp_frequency', 'pp_functional_activity', 'op_intensity',
'op_frequency' and 'op_functional_activity' that represent a patient's
presenting symptoms and disability and outcome symptoms and disability.

I have created calculated fields as per the following:
p_disability (control source:
=[pp_intensity]+[pp_frequency]+[pp_functional_activity]); o_disability
(control source: =[op_intensity]+[op_frequency]+[op_functional_activity]) and
d_change (control source: =([p_disability]-[o_disability])/[p_disability].

p_disability and o_disability calculate perfectly but d_change creates a
#name error. I have checked spelling and have used expression builder to
ensure correct terminology but can't for the life of me find what is
generating the error. Further, when I try to place p_disability and
o_disability as fields in a report they also generate #name errors. Any help
to set me on the right track would be greatly appreciated as I've been
working on this for days now!
 
I have created calculated fields as per the following:
p_disability (control source:
=[pp_intensity]+[pp_frequency]+[pp_functional_activity]); o_disability
(control source: =[op_intensity]+[op_frequency]+[op_functional_activity]) and
d_change (control source: =([p_disability]-[o_disability])/[p_disability].

p_disability and o_disability calculate perfectly but d_change creates a
#name error. I have checked spelling and have used expression builder to
ensure correct terminology but can't for the life of me find what is
generating the error. Further, when I try to place p_disability and
o_disability as fields in a report they also generate #name errors. Any help
to set me on the right track would be greatly appreciated as I've been
working on this for days now!

p_disability is a Textbox on the Form - it is NOT a field in the table
or in the query. Therefore it's not available on a Report, or even for
further calculations.

Just replace [p_disability] by the sum expression you use to calculate
it above; or do the p_disability calculation in a calculated field in
the Query upon which the subform is based, rather than in the control
source of a textbox.

John W. Vinson[MVP]
 
Thanks for your help.

I replaced [p_disability] and also [o_disability] in [d_change] with the
following -
( ( [pp_intensity] + [pp_frequency] + [pp_functional_activity] ) - (
[op_intensity] + [op_frequency] + [op_functional_activity] ) ) / (
[pp_intensity] + [pp_frequency] + [pp_functional_activity] )

I still get a #Name error.

I thought that if [p_disability] and [o_disability] are calculating
correctly, then the function above should operate correctly as well.

I'll try the Query and see how I go.

John Vinson said:
I have created calculated fields as per the following:
p_disability (control source:
=[pp_intensity]+[pp_frequency]+[pp_functional_activity]); o_disability
(control source: =[op_intensity]+[op_frequency]+[op_functional_activity]) and
d_change (control source: =([p_disability]-[o_disability])/[p_disability].

p_disability and o_disability calculate perfectly but d_change creates a
#name error. I have checked spelling and have used expression builder to
ensure correct terminology but can't for the life of me find what is
generating the error. Further, when I try to place p_disability and
o_disability as fields in a report they also generate #name errors. Any help
to set me on the right track would be greatly appreciated as I've been
working on this for days now!

p_disability is a Textbox on the Form - it is NOT a field in the table
or in the query. Therefore it's not available on a Report, or even for
further calculations.

Just replace [p_disability] by the sum expression you use to calculate
it above; or do the p_disability calculation in a calculated field in
the Query upon which the subform is based, rather than in the control
source of a textbox.

John W. Vinson[MVP]
 
Since my last post have resolved the #Name error in [d_change] => whoops
missed the = at the beginning of the function! Still have problems trying to
populate report with calculated field from [subform]. Appreciate all help
given.

Joe said:
Thanks for your help.

I replaced [p_disability] and also [o_disability] in [d_change] with the
following -
( ( [pp_intensity] + [pp_frequency] + [pp_functional_activity] ) - (
[op_intensity] + [op_frequency] + [op_functional_activity] ) ) / (
[pp_intensity] + [pp_frequency] + [pp_functional_activity] )

I still get a #Name error.

I thought that if [p_disability] and [o_disability] are calculating
correctly, then the function above should operate correctly as well.

I'll try the Query and see how I go.

John Vinson said:
I have created calculated fields as per the following:
p_disability (control source:
=[pp_intensity]+[pp_frequency]+[pp_functional_activity]); o_disability
(control source: =[op_intensity]+[op_frequency]+[op_functional_activity]) and
d_change (control source: =([p_disability]-[o_disability])/[p_disability].

p_disability and o_disability calculate perfectly but d_change creates a
#name error. I have checked spelling and have used expression builder to
ensure correct terminology but can't for the life of me find what is
generating the error. Further, when I try to place p_disability and
o_disability as fields in a report they also generate #name errors. Any help
to set me on the right track would be greatly appreciated as I've been
working on this for days now!

p_disability is a Textbox on the Form - it is NOT a field in the table
or in the query. Therefore it's not available on a Report, or even for
further calculations.

Just replace [p_disability] by the sum expression you use to calculate
it above; or do the p_disability calculation in a calculated field in
the Query upon which the subform is based, rather than in the control
source of a textbox.

John W. Vinson[MVP]
 
Since my last post have resolved the #Name error in [d_change] => whoops
missed the = at the beginning of the function! Still have problems trying to
populate report with calculated field from [subform]. Appreciate all help
given.

Don't even try to get the data from the subform.

Instead, just recapitulate the entire expression you use on the Form
as the control source of a textbox on the Report; or incorporate it in
a calculated field in a Query.

Bear in mind that a calculated expression on a Form isn't really
stored anywhere - it's JUST there for display, so it really isn't
designed to be used as a data source for other objects or expressions.

John W. Vinson[MVP]
 
Thanks John for your time and patience. I can see what I need to do now.

John Vinson said:
Since my last post have resolved the #Name error in [d_change] => whoops
missed the = at the beginning of the function! Still have problems trying to
populate report with calculated field from [subform]. Appreciate all help
given.

Don't even try to get the data from the subform.

Instead, just recapitulate the entire expression you use on the Form
as the control source of a textbox on the Report; or incorporate it in
a calculated field in a Query.

Bear in mind that a calculated expression on a Form isn't really
stored anywhere - it's JUST there for display, so it really isn't
designed to be used as a data source for other objects or expressions.

John W. Vinson[MVP]
 
Back
Top