Solved

Disabling a field based on another

Posted on 2011-03-23
4
234 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 35196876
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
 

Author Closing Comment

by:Patrick O'Dea
ID: 35197073
Thanks again.

I should have known that one!
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35197111
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
 

Author Comment

by:Patrick O'Dea
ID: 35197208
Thanks Peter,  

I will try to remember that one.

0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question