Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box makes others boxes available

Status
Not open for further replies.

AndreB

Programmer
Aug 21, 2001
13
US
Here is my problem:(It's a simple one)

I have 3 check boxes(only one can be "checked" at the same time) and a Text Box. What do I have to do for this Text Box be available only if Check Box #2 is selected???

 
Create an on open event on the form like so...


Private Sub Form_Open(Cancel As Integer)

TextBox.visible=false

End Sub

Then create an After Update event on Check Box2 like so...

Private Sub CheckBox2_AfterUpdate()

if CheckBox2.Value=-1 Then
TextBox.visible=true
end if

End Sub
 
Little modification of Pezamystik's post:

Private Sub Form_Current()
CheckBox2=false
TextBox.visible=false
End Sub

Private Sub CheckBox2_AfterUpdate()
TextBox.visible=CheckBox2
End Sub

Aivars
 
Variation on the theme

1. In the form's design view, set the textbox's Visible property to false.

2. In the checkbox 2 AfterUpdate event add the following code:
Code:
If Checkbox2.Value = -1 Then
        Me.Textbox.Visible = True
    Else
        Me.Textbox.Visible = False
    End If

3. In the Form's OnCurrent event, call the CheckBox2 AfterUpdate event:
Code:
Call Checkbox2_AfterUpdate

This sequence will set the textbox to visible or not depending upon the value of the checkbox every time the checkbox value is changed, AND every time the record is viewed.

HTH
Lightning
 
In Checkbox2_AfterUpdate place this statement.

Textbox.visible = Checkbox2

If Checkbox2 is True then Textbox.visible is True and visa versa.

mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top