Link to home
Start Free TrialLog in
Avatar of DMASRUD
DMASRUD

asked on

Combo box value to Text Box

QUESTION IS AT BOTTOM.  HERE IS THE BACKGROUND:

I have a main form called:
frmSales (to enter data to tblProdSales)

with fields:
Sales_Id (primary field)
Cust_Id (combo box to select)
Staff_Id (combo box to select)
Sales_PmtType
Sales_Comment

With a subform called:
sfrmSales_Detail  (to enter data to tblSales_Detail)

subform is linked to frmSales by Sales_Id

subform has fields:
SalesDetail_Id (primary key)
Sales_Id
Prod_Id (completed thru Combo box ProductPick)
Sales_Price
Sales_Units

Combo box ProductPick is written:
SELECT Prod_Id, Product, Vendor, Line, Price, Unit FROM qryProdRetailPrice
Column Count 6
Column Widths 0";3.5";1.3";0";0.7";0.3"

Question:  How do I get the Price value from the combo box ProductPick into the Price field?
Avatar of Sheils
Sheils
Flag of Australia image

You can try one of the following options:

Option1

Base the subform on the following query:

Select tblSales_Detail.SalesDetail_Id, tblSales_Detail.Sales_Id, tblSales_Detail.Prod_Id, qryProdRetailPrice.Sales_Price From tblSales_Detail INNER JOIN qryProdRetailPrice ON tblSales_Detail.Prod_Id = qryProdRetailPrice.Prod_Id

Option 1

Use the following code in the after update event of the combobox

Me.textboxname = me.comboboxname
Me.txtBox=Me.Combo.Column(5)  '5 is chosen here based on Price being the 6th field in your code above, the first column being column 0

Add this to the On Change Event of the Combo Box.
ASKER CERTIFIED SOLUTION
Avatar of dpavlick
dpavlick
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DMASRUD
DMASRUD

ASKER

Thanks so much.