Re: Editable field only based on another field
- From: julostarr <julostarr@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 1 Oct 2008 14:26:03 -0700
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
"Jeff Boyce" wrote:
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
"julostarr" <julostarr@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AC30040F-9A11-4173-A5D2-6E070ED669D2@xxxxxxxxxxxxxxxx
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
"John W. Vinson" wrote:
On Fri, 26 Sep 2008 11:05:41 -0700, "Jeff Boyce" <nonsense@xxxxxxxxxxxx>
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.
--
John W. Vinson [MVP]
- Follow-Ups:
- Re: Editable field only based on another field
- From: Jeff Boyce
- Re: Editable field only based on another field
- References:
- Re: Editable field only based on another field
- From: Jeff Boyce
- Re: Editable field only based on another field
- Prev by Date: Re: Making Check Boxes
- Next by Date: Re: Appending a table with Multivalued Fields in 2007
- Previous by thread: Re: Editable field only based on another field
- Next by thread: Re: Editable field only based on another field
- Index(es):
Relevant Pages
|
Loading