I'm trying to use VBA code to disable a field based on the value of another field in a form. The code I have properly updates the enabled property of the field when it changes; however, it changes it for the form as a whole instead of a single record. My form is set as a single form.
For example on record 1, field1's value is "records" and field2's enabled property is set to false. When I go to the next record (record 2), field2's enabled property remains set to false even though field1's value is now "measurable " which should make field2's enabled property as true. Here's the code I have right now:
I've tried using a requery setting on the form and also on field1's properties of GotFocus, but I haven't had any success. Any help would be greatly appreciated.
Thanks!
For example on record 1, field1's value is "records" and field2's enabled property is set to false. When I go to the next record (record 2), field2's enabled property remains set to false even though field1's value is now "measurable " which should make field2's enabled property as true. Here's the code I have right now:
Code:
Private Sub Field1_AfterUpdate() Me.Field2.Enabled = True If Me.Field1 = "records" Then Me.Field2.Enabled = False ElseIf Me.Field1 = "measurable" Then Me.Field2.Enabled = True End If
Thanks!
Comment