Auto populate a price in a separate field

N

Nyla K

I'm creating an order entry form, which includes a combo box that allows the
end-user to pick from a table called "Product List". The "Product List" has
the following fields: product unique ID, description, and price.

I would like to be able to choose a particular product from the combo box
and automatically populate the price of that product in a separate field
(Price). I would then enter the number of products being ordered and have
that number multiply by the price of the item to update the "Total" field.
For example:

a) Product ID: "Product Price" field x "Number of Orders" field =
"Total Cost" field

What would be the best way to go about doing this?

Thanks,
Nyla
 
A

Al Camp

Nyla,
Your combo box should have the ProductID, Desc, and Price fields in 3
columns. Use the AfterUpdate event of your combo to set the Price. Since
combo box columns are numbered 0, 1, 2, etc, and your price is in the 3rd
column, your AfterUpdate code would be... (use your own field names)
Me.Price = cboYourComboName.Column(2)

Also, there would be no need to "save" the Total. Since you're
capturing Price and Qty... Total can be a calculated "unbound" field that
just "displays" the result on your form.
Just place = [Price] * [Qty] in the ControlSource of your Total.
It will always display the correct amount, even if you change the Price or
the Qty.
Don't save the result of a calculation... it can be "re-calculated on
the fly" in any subsequent form, query, or report.
hth
Al Camp
 
N

Nyla K

Thank you, Al. I'll try your suggestion as I'm sure it'll work just fine.

Al Camp said:
Nyla,
Your combo box should have the ProductID, Desc, and Price fields in 3
columns. Use the AfterUpdate event of your combo to set the Price. Since
combo box columns are numbered 0, 1, 2, etc, and your price is in the 3rd
column, your AfterUpdate code would be... (use your own field names)
Me.Price = cboYourComboName.Column(2)

Also, there would be no need to "save" the Total. Since you're
capturing Price and Qty... Total can be a calculated "unbound" field that
just "displays" the result on your form.
Just place = [Price] * [Qty] in the ControlSource of your Total.
It will always display the correct amount, even if you change the Price or
the Qty.
Don't save the result of a calculation... it can be "re-calculated on
the fly" in any subsequent form, query, or report.
hth
Al Camp


Nyla K said:
I'm creating an order entry form, which includes a combo box that allows
the
end-user to pick from a table called "Product List". The "Product List"
has
the following fields: product unique ID, description, and price.

I would like to be able to choose a particular product from the combo box
and automatically populate the price of that product in a separate field
(Price). I would then enter the number of products being ordered and have
that number multiply by the price of the item to update the "Total" field.
For example:

a) Product ID: "Product Price" field x "Number of Orders" field =
"Total Cost" field

What would be the best way to go about doing this?

Thanks,
Nyla
 
A

Al Camp

OK... post back if you still have problems.
Al Camp

Nyla K said:
Thank you, Al. I'll try your suggestion as I'm sure it'll work just fine.

Al Camp said:
Nyla,
Your combo box should have the ProductID, Desc, and Price fields in 3
columns. Use the AfterUpdate event of your combo to set the Price.
Since
combo box columns are numbered 0, 1, 2, etc, and your price is in the 3rd
column, your AfterUpdate code would be... (use your own field names)
Me.Price = cboYourComboName.Column(2)

Also, there would be no need to "save" the Total. Since you're
capturing Price and Qty... Total can be a calculated "unbound" field that
just "displays" the result on your form.
Just place = [Price] * [Qty] in the ControlSource of your
Total.
It will always display the correct amount, even if you change the Price
or
the Qty.
Don't save the result of a calculation... it can be "re-calculated
on
the fly" in any subsequent form, query, or report.
hth
Al Camp


Nyla K said:
I'm creating an order entry form, which includes a combo box that
allows
the
end-user to pick from a table called "Product List". The "Product
List"
has
the following fields: product unique ID, description, and price.

I would like to be able to choose a particular product from the combo
box
and automatically populate the price of that product in a separate
field
(Price). I would then enter the number of products being ordered and
have
that number multiply by the price of the item to update the "Total"
field.
For example:

a) Product ID: "Product Price" field x "Number of Orders" field =
"Total Cost" field

What would be the best way to go about doing this?

Thanks,
Nyla
 

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