how to disable certain fields in Form?

vaibhav2015

Registered User.
Local time
Tomorrow, 01:30
Joined
Sep 15, 2015
Messages
25
Hi,
can you please advice how I can disable fields in access.
I want to disable fields as per combo box selection. (option-"vc";"non-vc")

I tried below codes but other fields are still enabled. I want to disable that tields based on combo box option.

Private Sub Mat_type_AfterUpdate()

If Me.Mat_type.Value = "VC" Then
Me.Curr.Enabled = False
Me.TP.Enabled = False
Me.Plant.Enabled = True
Me.Plant.SetFocus

End If

End Sub
 
it should work. I would lose the .value suffix.

what exactly is not working?
 
That doesn't look that wrong... Not sure about using .Value
Add a debug to make sure you are getting the value you think you are;
Code:
Private Sub Mat_type_AfterUpdate()

Debug.print me.Mat_Type

If Me.Mat_type = "VC" Then
     Me.Curr.Enabled = False
     Me.TP.Enabled = False
     Me.Plant.Enabled = True
     Me.Plant.SetFocus
Else
    Me.Curr.Enabled = True
     Me.TP.Enabled = True
     Me.Plant.Enabled = False
     
End If
 
Last edited:
When I select combo box (Mat_type) to "VC" then specific fields should get disabled, but that is not happening.
Do I need to enable VBA setting in access same like we do setting for Marcos.
I tried above VBA code but that not working.
 
Hi, I checked Access option and enabled all VBA and macros setting.
Thanks Minty, that codes working
 

Users who are viewing this thread

Back
Top Bottom