Bound or unbound

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you bind a control when the control source is based on the selection
in a combo box? The control source is determined by the selection made.
 
Steph,
The ControlSource property of your combo should be set to a field in your
table... that "binds" the combo to that field. Whatever value you select in
the combo will be stored in that field.
The RowSource property of the combo is the query behind the combo that
displays the possible choices for user selection.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
On the after update event of the combo, write code that check the selection
and assign the right control source

Select Case Me.ComboName
case 1
me.TextBox.ControlSource = "A"
case 2
me.TextBox.ControlSource = "B"
case 3
me.TextBox.ControlSource = "C"
End Select
 
Steph,
Sorry... I completely misunderstood your question.
Looks like Ofer's got a solution for you.

Regarding Ofer's solution... you might want to consider using the
BeforeUpdate event to make the ControlSource decision.

But... try his first, but keep the BeforeUpdate in mind if you have
problems.
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
How do you bind a control when the control source is based on the selection
in a combo box? The control source is determined by the selection made.

If you're going to do this - and see below, it's likely to be a BAD
IDEA - then you would need to explicitly set the textbox's Control
Source property to the fieldname in the combo box's AfterUpdate event.

The need to do this makes me suspect that your table design needs a
look. Are you storing *data* in fieldnames, and using the combo to
select which field to display? As the combo's row source changes, will
you need to continually add fields to your table? If so, you may need
a second table instead of more fields.

John W. Vinson[MVP]
 
Back
Top