Solved

Disabling a field based on another

Posted on 2011-03-23
4
211 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now