Frustration (Simple IF Statement)

Vav

Registered User.
Local time
Today, 20:22
Joined
Aug 29, 2002
Messages
36
Hello, I have been looking at this project for way too long.

Could someone help me with a bit of code.

What I need is an IF Statement for a Check Box.

The form has a text box (1). I want to write a line of code so that if the "Yes" value of the check box is selected the hidden txt box (2) will appear and the contents will be populated with the contents of txt box (1)

I have the txt Box (2) set as visible false on form load.

THere are two check boxes. Yes / No. If No is selected I want txt Box (2) to disappear and be cleared. If the Yes is selected then I want the txt box to reappear and take on the value of txt box (1)

THanks

Peter Vav
 
There is no point in having two Check boxes (Yes and No) because the value of a single CheckBox is Yes or No (True or False). One will work fine. In the On Click event of the "Yes" Check box put....
Code:
Private Sub Yes_Click()

    If Me.Yes = True Then
        Me.TextBox2.Visible = True
        Me.TextBox2 = Me.TextBox1
    Else
        Me.TextBox2.Visible = False
        Me.TextBox2 = Null
    End If

End Sub
and in the Forms On Current event put...
Code:
Private Sub Form_Current()

    If Me.Yes = True Then
        Me.TextBox2.Visible = True
    Else
        Me.TextBox2.Visible = False
    End If
    
End Sub

HTH
IMO
 

Users who are viewing this thread

Back
Top Bottom