Access97 - Combo box

  • Thread starter Thread starter Abay
  • Start date Start date
A

Abay

I have a form for a client table which takes info from a property table, the
link being property name in both tables. I would like to set up a combo box
which enters both the property name and a commission value from the property
table into the client table .. i.e. enter both values displayed on the two
columns of the combo box.

I created a combo box with the wizard and when I key part of the property
name I can select the correct row, I can get it to enter one or other of
the values but not both .. egg .. I get a drop down list of both property
names, and commissions, and when a particular row is selected the commission
field is updated in the client table. I would like both the property name
and the commission value to update the client table. Note: the property name
is the key in the property table.

This is probably really dumb question & I apologise.. I have some reference
books (a bit of a newbie),and am teaching myself access, but can't seem to
find the answer <sigh>

Any help would be much appreciated.
abay
 
Abay said:
I have a form for a client table which takes info from a property
table, the link being property name in both tables. I would like to
set up a combo box which enters both the property name and a
commission value from the property table into the client table ..
i.e. enter both values displayed on the two columns of the combo box.

I created a combo box with the wizard and when I key part of the
property name I can select the correct row, I can get it to enter
one or other of the values but not both .. egg .. I get a drop down
list of both property names, and commissions, and when a particular
row is selected the commission field is updated in the client table.
I would like both the property name and the commission value to
update the client table. Note: the property name is the key in the
property table.

This is probably really dumb question & I apologise.. I have some
reference books (a bit of a newbie),and am teaching myself access,
but can't seem to find the answer <sigh>

Any help would be much appreciated.
abay

A combo box can have only one "bound column"; that is, only one of its
columns can be the one that constitutes the value of the control, and
hence is automatically stored in the field (if any) to which the combo
box is bound. But you can use code to pick up the value from a
different column and stick it into some other field. For example, if
your combo is named and bound to "PropertyName", with columns
"PropertyName" and "Commission", then you could use code in the combo's
AfterUpdate event to get the commission from the second column and put
it in the form's Commission field:

'----- start of example code -----
Private Sub PropertyName_AfterUpdate()

Me!Commission = Me!PropertyName.Column(1)

End Sub
'----- end of example code -----

Note that the second column of the combo box is .Column(1), because the
columns are numbered from 0.
 
Back
Top