Show text box after selecting value list value

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

I have a value list with three pre-defined values (listed under "row source"
in the properties). I also have three bound text boxes on the same form
that are going to be related to these values. Is there a way to only make
visible the text box that should be associated with a certain value when the
value is selected from the list (i.e. text box "Name" appears on the form
after the value "First Name" is selected in the pull down menu of the value
list box)?
 
Sure; use a Select Case statement in the AfterUpdate event
of the pre-defined list control:

Select Case Me!YourListControlName
Case "Name"
Me!TextBox1.Visible = True
Me!TextBox2.Visible = False
Me!TextBox3.Visible = False
Case "2ndvalue"
Me!TextBox1.Visible = False
Me!TextBox2.Visible = True
Me!TextBox3.Visible = False
Case "3rdvalue"
Me!TextBox1.Visible = False
Me!TextBox2.Visible = False
Me!TextBox3.Visible = True
Case Else
' If value is deleted, either show all or hide all
Me!TextBox1.Visible = False
Me!TextBox2.Visible = False
Me!TextBox3.Visible = False

End Select

HTH
Kevin Sprinkel
 
Back
Top