Hello,
I am trying to write a code where if a user selects a value from a dropdown menu in a field, then it would grey out another field.
Here is an example:
I have a field called production type with two options in it, "Oil" or "Gas".
I have another field called Oil production per year and another called Gas production per year.
Let's say the user selects oil in the Production type field, I would like the gas production per year field to be disabled and the Oil Production per year field stays enabled.
If the user selects Gas then the Oil production per year should be disabled and the Gas production per year is enabled.
This is the code i tried.
Code:
Private Sub Production_Type_Combo_AfterUpdate() If Me.Production_Type_Combo = "Gas" Then
Me.Oil_Production_Increase_Per_Day_Text.Enabled = False And Me.Gas_Production_Day_Increase_Text.Enabled = True
ElseIf Me.Production_Type_Combo = "Oil" Then
Me.Gas_Production_Day_Increase_Text.Enabled = False And Me.Gas_Production_Day_Increase_Text.Enabled = True
Else:
Me.Gas_Production_Day_Increase_Text.Enabled = True And Me.Oil_Production_Increase_Per_Day_Text.Enabled = True
End If
End Sub
Thank you in advance!