data in a form

  • Thread starter Thread starter kevin carter
  • Start date Start date
K

kevin carter

HI
i have a table containing three fields
component price index(primary key)
what i want to do on a form is select the component from a combobox and have
the price for the product display in a text box
can anyone help me i am lost(new at this)

thanks in advance


kevin
 
Base the RowSource of your combo box on your table.

If your colums are in the following order;
Index
Component
Price

Then you would use this as the AfterUpdate() event of your
combo box;

Private Sub myComboBox_AfterUpdate()
Me!myTextBox = Me!myComboBox.Column(2)
End Sub

The columns collection is zero based, so;
column 1 = ctl.Column(0)
column 2 = ctl.Column(1)
column 3 = ctl.Column(2)
etc...

good luck!
 
kevin said:
HI
i have a table containing three fields
component price index(primary key)
what i want to do on a form is select the component from a combobox and have
the price for the product display in a text box
can anyone help me i am lost(new at this)

thanks in advance


kevin
Me!Price_Control = Me!ComboBox.Column(1)
The combo box is base 0 so column 1 is 0 and column 2 is 1.
Put this in the AfterUpdate event of the combo box.

Ron
 
thanks i give a go now
Elwin said:
Base the RowSource of your combo box on your table.

If your colums are in the following order;
Index
Component
Price

Then you would use this as the AfterUpdate() event of your
combo box;

Private Sub myComboBox_AfterUpdate()
Me!myTextBox = Me!myComboBox.Column(2)
End Sub

The columns collection is zero based, so;
column 1 = ctl.Column(0)
column 2 = ctl.Column(1)
column 3 = ctl.Column(2)
etc...

good luck!
 
Back
Top