Solved

Disable editing on form based on selection of another field

Posted on 2013-01-25
6
332 Views
Last Modified: 2013-01-25
I have a form that has several fields on it.  One of the controls is a Yes/No check box that the user selects if applicable.  The default is unchecked.

When the user checks the box, I want a couple of the other fields to grey out where the user cannot enter data into those fields.

The Yes/No check box is called RateCardCheck.  The fields I want to grey out if RateCardCheck is check are:

dtaEstValue
dtaEstLabor$
dtaProjHrs

I tried an After Update to make the 3 fields not visible but it only worked once.  When I unchecked the box, the fields did not re-appear.
0
Comment
Question by:actolex
  • 3
  • 2
6 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38819874
use the afterupdate or click event of the checkbox

me.dtaEstValue.enabled=not me.RateCardCheck

me.[dtaEstLabor$].enabled=not me.RateCardCheck

me.dtaProjHrs.enabled=not me.RateCardCheck
0
 
LVL 30

Expert Comment

by:hnasr
ID: 38820249
If version:

If RateCardCheck Then
    dtaEstValue.Enabled = False
    dtaEstLabor$.Enabled=False
    dtaProjHrs.Enabled=false
Else
    dtaEstValue.Enabled = True
    dtaEstLabor$.Enabled=True
    dtaProjHrs.Enabled=True
End IF
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38820255
too many lines of codes, when you can do it 3
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:actolex
ID: 38820668
Both don't work....I'll try again this weekend.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 38820685
what codes do you have?

post it here.


is it  like this

private sub RateCardCheck_afterUpdate()

me.dtaEstValue.enabled=not me.RateCardCheck

me.[dtaEstLabor$].enabled=not me.RateCardCheck

me.dtaProjHrs.enabled=not me.RateCardCheck 

end sub

Open in new window


or this

private sub RateCardCheck_click()

me.dtaEstValue.enabled=not me.RateCardCheck

me.[dtaEstLabor$].enabled=not me.RateCardCheck

me.dtaProjHrs.enabled=not me.RateCardCheck 

end sub

Open in new window


and

private sub form_current()

me.dtaEstValue.enabled=not me.RateCardCheck

me.[dtaEstLabor$].enabled=not me.RateCardCheck

me.dtaProjHrs.enabled=not me.RateCardCheck 

end sub

Open in new window

0
 

Author Comment

by:actolex
ID: 38820925
capricorn1....I used the first set of code...now works great !!!!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.

747 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

12 Experts available now in Live!

Get 1:1 Help Now