Multiplying a combo box and a label in the same form on an afterup

J

JT

In a single form, I am looking to multiply the result of a combo box
selection and a label entry to show up in another label automatically

here are the elements I am working with

Table: "tbl_parts"
Fields: plant/part_num/price

In a form: "frm_data"
I have 2 combo boxes
"cbo_city" and "cbo_part"
(cbo_city cascades down to cbo_part)

In the same form I have a quantity label: "lbl_qty"
and also a payment amount Label: "lbl_pmtamt"

Based on which part number is selected in "cbo_part" I need to multiply the
price associated with that part by the quantity entered in "lbl_qty" and have
the results show up in "lbl_pmtamt"
 
F

fredg

In a single form, I am looking to multiply the result of a combo box
selection and a label entry to show up in another label automatically

here are the elements I am working with

Table: "tbl_parts"
Fields: plant/part_num/price

In a form: "frm_data"
I have 2 combo boxes
"cbo_city" and "cbo_part"
(cbo_city cascades down to cbo_part)

In the same form I have a quantity label: "lbl_qty"
and also a payment amount Label: "lbl_pmtamt"

Based on which part number is selected in "cbo_part" I need to multiply the
price associated with that part by the quantity entered in "lbl_qty" and have
the results show up in "lbl_pmtamt"

Why i the world are you using a label to display the Qty data and
Payment data in instead of a text control?
Where does [lbl_Qty] get it's Qty data from?

At the very least, change the [lbl_pmtamt] to an unbound text control.

How do we know what the price is that is associated with the value
selected in the combo box? Is it stored someplace? Is it displayed in
a column in the combo box?

Here are generic expressions. You'll have to figure the actual
expression as you haven't given enough information.

Using an unbound text control for lbl_pmtamt on your form (not a
label) set it's control source to:

If you keep lbl_Qty as a Label
=Val([lbl_qty].Caption) * Some price value associated with the
selected item in the combo box.

If you add the price to the combo box as an additional column, then
you could use:

If you keep lbl_Qty as a Label
=Val([lbl_qty].caption) * [ComboName].Column(1)
where column(1) is the 2nd column (Combos are Zero based).

It would make more sense to change [lbl_Qty] to a text control also.
In that case the expression would be:

If you change lbl_Qty to a text control
=[Qty_Control] * [ComboName].Column(1)
 

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