Show a textbox on a form in response to another event.

  • Thread starter Thread starter Russell
  • Start date Start date
R

Russell

Is there a way in Access to hide a textbox, and to only
show it if a particular checkbox that represents a yes/no
feild is checked?
 
Russell said:
Is there a way in Access to hide a textbox, and to only
show it if a particular checkbox that represents a yes/no
feild is checked?

Yep. In form design view, set the visible property of the text box (called
"txt1") to No so that when the form opens txt1 is invisible.
In the AfterUpdate event of the checkbox (called "chk1") whack in:

If chk1 = True Then
txt1.Visible = True
Me!txt1.SetFocus 'this will move the cursor to txt1
Else
txt1.Visible = False
Me!someotherfield.SetFocus 'not really necessary but nice
End If

Easy!
 
Perhaps, a single statement:

Me.txtBox1.Visible = Me.chkBox1.Value

should do. ".Value" is not even needed but it is my habit
to include ".Value".

HTH
Van T. Dinh
MVP (Access)
 
Back
Top