Access fields

C

cbart

How to..? I want a field in a form to available/not available contingent on
data in other fields. For example, if Field 1 is a checked checkbox, then I
want Field 2 to be active for data entry, but if Field 1 is not checked, then
I want Field 2 to be grayed out and not available for data entry. Any ideas?
Thanks.
 
R

Rick B

Did you try searching for your answer? This is posted almost every single
day...


I found this when I searched google...


The simplest way is to put some code that checks for an entry in the
after update event for your check box. Something like this will do the
trick.

Private Sub FieldA_AfterUpdate()
If Me.FieldA = True Then
Me.FieldB.Enabled = True
End If
End Sub


You will need to change the 'enabled' property for FieldB to 'No' and
also change the default value of your check box to false. Don't forget
to change the default value in the table as well.
 
R

Rick B

A similar solution a bit further down in the search....


On the click event of the check box:


mycontrol.enable = mycheckbox
myothercontrol.enable = mycheckbox


if mycheckbox is unchecked(false), the other controls will be enabled=false.
If
mycheckbox is checked (true) the other controls will be enabled=true.


you may want to set the controls to enabled=false on the properties of each
control.
 
C

cbart

Thank you, Rick B. I tried several Google searches, but couldn't find
exactly what I needed. It could be that I didn't word the search "just
right". Anyhoo.. your suggestions look like they will work great. Thank you
so much for your quick response. Very much appreciated - Colleen B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top