Well, I never could get the Me![TextBox].Enabled = Me![Checkbox] to
work,
but
I played around with an IF Expression and it worked for me. If the
checkbox
is checked it goes to the following field to allow editing and if it is
unchecked then the next field is uneditable and tabbing through it
skips
that
field. The code I used goes as follows:
Private Sub Ctl401_k_Participant_AfterUpdate()
If Me![401(k)Participant] = True Then
Me![401(k)%].Enabled = True
Else
Me![401(k)%].Enabled = False
End If
End Sub
I'm still learning about VBA, but this IF conditional express worked
for
me
in this situation. I was expecting the field in question to be grayed
out
when it was uneditable, but it is fine this way.
If you have any tips for me or can help me understand this a little
more
that would be great. If not thank you so much for you help.
--
julostarr
:
If you entered that directly in the space following the label for
AfterUpdate in the properties, Access will try to find a macro with
that
name.
To be more specific, you will need to create an AfterUpdate event
procedure
and enter that expression in the event procedure.
Regards
Jeff Boyce
Microsoft Office/Access MVP
Can you help me out with understanding this a little more. I
entered
this:
Me![TextBox].Enabled = Me![Checkbox]
in the After Update under properties of my checkbox control, of
course
substituting the TestBox name I wanted to enable for TestBox and the
same
for
the Checkbox. When I go back to the form view and click the check
box
I
get
an error saying the the Macro doesn't exist. Am I supposed to build
a
macro
or am I entering something wrong.
--
julostarr
:
On Fri, 26 Sep 2008 11:05:41 -0700, "Jeff Boyce"
<
[email protected]>
wrote:
If I wanted to enable a textbox based on whether a checkbox were
checked,
I'd probably add something like the following in the checkbox's
AfterUpdate
event:
Me!TextBox.Enabled = Me!Checkbox
.... and also the Form's Current event, to handle existing records,
I'd
suggest.