Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disabling a field based on another

Posted on 2011-03-23
4
Medium Priority
?
255 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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

886 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