Combo box and text box dependency

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

I have a combo box 'cboRepairType' where the Rowsource is:

SELECT * FROM tblGrips ORDER BY GripType

'tblGrips' has three fields

GripType -Text
BuyPrice -Currency
SellPrice -Currency

I have a text box 'txtSellPrice' and the following code to accompany it

"Private Sub cboRepairType_AfterUpdate()
Me.txtSellPrice = cboRepairType.Column(2)
End Sub"

Why does the value from 'tblGrips.SellPrice' not show in the text box. If I
change the .Column(2) to .Column(1) I get the BuyPrice field value. Ideally
I would like to use both of these values
Any advice?

Sandy
 
Sandy said:
I have a combo box 'cboRepairType' where the Rowsource is:

SELECT * FROM tblGrips ORDER BY GripType

'tblGrips' has three fields

GripType -Text
BuyPrice -Currency
SellPrice -Currency

I have a text box 'txtSellPrice' and the following code to accompany
it
"Private Sub cboRepairType_AfterUpdate()
Me.txtSellPrice = cboRepairType.Column(2)
End Sub"

Why does the value from 'tblGrips.SellPrice' not show in the text
box. If I change the .Column(2) to .Column(1) I get the BuyPrice
field value. Ideally I would like to use both of these values
Any advice?

Sandy

What is the ColumnCount property of your ComboBox set to? Just because the
RowSource query has three fields doesn't mean the ComboBox will use all of them.
 
Hi Rick,

The column count was 1 I have now made that 3, would that be the correct
setting?( it seems to produce the desired result).

Also why is it that with the text box formatted as Currency the display is
not? It shows as being a number eg 4.5.

Thanks
Sandy
 
Back
Top