Calculated Field in Subform

T

Theresa

Hi:

I have created a subform and inserted a textbox where I would like to
calculate a value. One of the fields required for the calculation is a
lookup field to another table. When I create the calculation, it takes the
value of the bound column instead of the actual value for the calculation.
If I take the value from the original table, I get a name error.

Any help would be appreciated.
 
A

Arvin Meyer MVP

Use a reference to the correct column:

cboFieldName.Column(1)

Column(1) is the second column, the column index being zero based.
 
A

Arvin Meyer MVP

It should use the bound column in absence of you telling it which column to
use. If you have succumbed to the bad practice of using lookup fields, it
becomes even more difficult because you cannot see what the correct column
really is:

http://www.mvps.org/access/lookupfields.htm

If that's the case, fix the table and use a query as the rowsource for the
combo. Then you will easily be able to tell which column to read.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Theresa said:
My combo box shows the correct value in datasheet view in the field.
However
when I use this field in the calculation:

=[Total Watts]*[Operating_Hours]*[Rate KWH]/1000

it uses the bound column. The field I am referring to is Operating Hours
where the value is coming from the Operating_Hours_tbl

Arvin Meyer MVP said:
Use a reference to the correct column:

cboFieldName.Column(1)

Column(1) is the second column, the column index being zero based.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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