Combo box and text box dependency

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
 
R

Rick Brandt

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.
 
S

Sandy

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
 

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