Field relating to a combos selection

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi All,

I have a combo on my page which I need to use the selection from to fill a
txtbox with some information from the same table as the combo came from.

The cbo (cbodriver) comes from tbldriver where on an orders page the user
will select a driver. In the tbldriver there is also a field called
agreedrate which holds that drivers agreed rate per delivery. I have
created a txtbox called txtaggdelrate.

I hope I have explained it clearly enough,

Thanks in advance,

Rob
 
Rob, do this:

on your form, select the combo, and set these properties:
The record source for the combo:: "Select agreedate, driver from tblDriver"
set property column count = 2
set Bound Column = 1
set property column widths = 0

on the combos after update event, add this code:

If not isnull(Me!ComboName ) then
me!txtAgddDelRate = Me!ComboName.Column(0)
end if

That's it! The combo can keep several fields, and by setting the width of
the first colum = 0, it's not visible.
 
Hi Rob

In the query that you use as the Row Source of the drivers combo
(cboDriver), select 3 fields, the DriverID, the Driver's Name and the
AgreedRate.

Open the form with the cboDriver in design mode and change the properties of
cboDriver to;

Column Count: 3
Column Widths: 0;x;0 (where x is the width you want for the driver's name)

In the AfterUpdate event of cboDriver add the following;

Me.txtAgDelRate = Me.cboDriver.Column(2)

Note: The Column property is 0 based so Column(2) is the 3rd column

HTH

Andy
 
Back
Top