Disabling a field based on another

See my VBA below.

I have not used this before.

When I compile the "Enabled" bit is highlighted with an error "Invalid Use Of Property".

Is my syntax wrong??
I have tried different combinations but no joy!
Private Sub Form_Current()
If tblCustomers.OverrideYN = "Y" Then Me.OverRidePrice.Enabled
Else
Me.OverRidePrice.Locked
End If
End Sub

Open in new window

Patrick O'DeaAsked:
Who is Participating?
 
peter57rConnect With a Mentor Commented:
Try this to see if it's what you want.

Private Sub Form_Current()
If tblCustomers.OverrideYN = "Y" Then
Me.OverRidePrice.Enabled = true
Else
Me.OverRidePrice.enabled = false
End If
End Sub
0
 
Patrick O'DeaAuthor Commented:
Thanks again.

I should have known that one!
0
 
peter57rCommented:
You can say
if x then ...
because that gets interpreted as
if x is true then....

But when assigning values an ' = True/false'  must be used.
0
 
Patrick O'DeaAuthor Commented:
Thanks Peter,  

I will try to remember that one.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.