expression

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have a form that I would like to calculate a value.
I have a combobox that lists the item which pulls from an item master table
which also has the cost listed. I would like the qty box times the standard
cost to appear in another box. How do I do that when the cost per item is
not showing?
 
I am thinking an afterevent expression. Meaning after the quantity is
entered the expression calculates. But I am back to how do I reference the
item in the combobox to go to that table item master and pull the unit cost
to complete the expression.

Thanks
 
You can try the following.

In the control where you want to show the calculated value
-- Set the control's source to
= [Name of Combobox].Column(1) * [Quantity]

Columns are zero-based, so if you want the value in the 2nd column you would
specify column(1).

You realize that this will show the calculated value. It will not store the
calculated value.

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
How would I store the value then in the table?

John Spencer said:
You can try the following.

In the control where you want to show the calculated value
-- Set the control's source to
= [Name of Combobox].Column(1) * [Quantity]

Columns are zero-based, so if you want the value in the 2nd column you would
specify column(1).

You realize that this will show the calculated value. It will not store the
calculated value.

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
I have a form that I would like to calculate a value.
I have a combobox that lists the item which pulls from an item master table
which also has the cost listed. I would like the qty box times the standard
cost to appear in another box. How do I do that when the cost per item is
not showing?
 
Well, normally if you can calculate it, you don't save it.

If you want to save the value, then a control on the form will need to
be bound to the appropriate field and then you will need to use VBA to
populate the field when Quantity is entered/changed and when the
combobox value changes.

You can either use the after update event of those two controls and put
code like the following in each after update event.

Me.[NameOfCostControl] = Me.[Name of Combobox].Column(1) * Me.[Quantity]



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

How would I store the value then in the table?

John Spencer said:
You can try the following.

In the control where you want to show the calculated value
-- Set the control's source to
= [Name of Combobox].Column(1) * [Quantity]

Columns are zero-based, so if you want the value in the 2nd column you would
specify column(1).

You realize that this will show the calculated value. It will not store the
calculated value.

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
I have a form that I would like to calculate a value.
I have a combobox that lists the item which pulls from an item master table
which also has the cost listed. I would like the qty box times the standard
cost to appear in another box. How do I do that when the cost per item is
not showing?
 

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

Back
Top