Disable & Enabled Controls

lxh

Registered User.
Local time
Today, 08:38
Joined
Feb 26, 2004
Messages
43
Deactivating fields from response

Hi All

Can some one tell me how to "grey out" or certain fields of a form inactive depending on the response of a drop down box or tick box?

For example: Do you have a bank account? - tick box yes; then allow entry of bank details; else leave the fields in a state such that data can not be entered.

Thanks
Lex
 
First of all, you are not wanting to disable fields. You want to disable controls.

Secondly, here you go...

Code:
Private Sub MyCheckBox_AfterUpdate()
    If Me.MyCheckBox = True Then
        Me.MyTextBox.Enabled = True
    Else
        Me.MyTextBox.Enabled = False
    End If
End Sub
 
Thanks Mile-O-Phile,

Thanks Mile-O-Phile, that looks like just what I need - I'll give it a go after work tonight.
Lex

Mile-O-Phile said:
First of all, you are not wanting to disable fields. You want to disable controls.

Secondly, here you go...

Code:
Private Sub MyCheckBox_AfterUpdate()
    If Me.MyCheckBox = True Then
        Me.MyTextBox.Enabled = True
    Else
        Me.MyTextBox.Enabled = False
    End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom