Disable selected fields in a form

nayaz

Registered User.
Local time
Today, 09:55
Joined
Jun 23, 2009
Messages
12
Hi

Need Help!

Depending upon value in a field, I want to disable certian fields - disable data entry into these fields and if the vaue changes in the specific field, enable the fields so that data can be entered.

Thanks
 
Typically I use VBA code in the "After Update" event of a control like a text box to determine when to enable or disable other controls.

Code:
If me.NameOfControl <> Some Value then
     Me.NamOfOtherControl.Enabled = true
Else
     Me.NamOfOtherControl.Enabled = false
End If

If you have several controls that you need to disable at the same time based on the value of the specific control then you can create a user defined function and call that function to make the other controls enabled or disabled as needed.

Code:
Function EnableDisableCtrls(Status as Boolean)
     Me.NamOfOtherControl1.Enabled = Status
     Me.NamOfOtherControl2.Enabled = Status
     Me.NamOfOtherControl3.Enabled = Status
End function

The you can call the function like this when you need to disable the controls:

EnableDisableCtrls False

Or if you need to enable them:

EnableDisableCtrls True
 

Users who are viewing this thread

Back
Top Bottom