A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Editable field only based on another field



 
 
Thread Tools Display Modes
  #11  
Old September 30th, 2008, 10:08 PM posted to microsoft.public.access.tablesdbdesign
julostarr
external usenet poster
 
Posts: 45
Default Editable field only based on another field

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"
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]

  #12  
Old September 30th, 2008, 10:51 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Editable field only based on another field

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" wrote in message
...
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"
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]



  #13  
Old October 1st, 2008, 10:26 PM posted to microsoft.public.access.tablesdbdesign
julostarr
external usenet poster
 
Posts: 45
Default Editable field only based on another field

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" wrote in message
...
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"
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]




  #14  
Old October 2nd, 2008, 12:32 AM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Editable field only based on another field

I don't know why the expressioin didn't work ... did you get an error
message? Did you insert a breakpoint in the code so you could step through
it one statement at a time and see what values were being returned?

Congratulations on a solution!

Regards

Jeff Boyce
Microsoft Office/Access MVP


"julostarr" wrote in message
...
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" wrote in message
...
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"

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]






  #15  
Old October 2nd, 2008, 09:15 PM posted to microsoft.public.access.tablesdbdesign
julostarr
external usenet poster
 
Posts: 45
Default Editable field only based on another field

I did get an error message with the other code before. I'm not sure if it
was because I did't put it in right or what. Anyway, I tried it again and it
worked now. I do have another question though. I notice that with either of
these solutions. The field that I wanted disabled/enabled with relation to
the checkbox is only disabled after I check the box and then uncheck it
again. Is there a way to make it disabled until the checkbox is checked Yes
and then disabled again if the checkbox is unchecked? I realize that the
After Update makes these expressions apply only After Update of course, but I
tried to put these solutions in the Before Update and it didn't change
anything.

I'm also thinking about trying to do something similar with a list/dropdown
box. I would like to make one choice from the list box enable one field and
disable another and do the oposite with another choice from the same
list/dropdown box and maybe a third choice to disable both fields. It seems
like maybe If...Then...Else could be used in some way I'm just unsure exactly
how.

P.S. If my question is confusing let me know and I'll try to rephrase it.
--
julostarr


"Jeff Boyce" wrote:

I don't know why the expressioin didn't work ... did you get an error
message? Did you insert a breakpoint in the code so you could step through
it one statement at a time and see what values were being returned?

Congratulations on a solution!

Regards

Jeff Boyce
Microsoft Office/Access MVP


"julostarr" wrote in message
...
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" wrote in message
...
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"

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]







  #16  
Old October 2nd, 2008, 11:16 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Editable field only based on another field

Given that this new question is somewhat different, you'd get more eyes (and
brains) working on it if you posted it as a new question, rather than
burying it so far down in the current thread.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"julostarr" wrote in message
...
I did get an error message with the other code before. I'm not sure if it
was because I did't put it in right or what. Anyway, I tried it again and
it
worked now. I do have another question though. I notice that with either
of
these solutions. The field that I wanted disabled/enabled with relation
to
the checkbox is only disabled after I check the box and then uncheck it
again. Is there a way to make it disabled until the checkbox is checked
Yes
and then disabled again if the checkbox is unchecked? I realize that the
After Update makes these expressions apply only After Update of course,
but I
tried to put these solutions in the Before Update and it didn't change
anything.

I'm also thinking about trying to do something similar with a
list/dropdown
box. I would like to make one choice from the list box enable one field
and
disable another and do the oposite with another choice from the same
list/dropdown box and maybe a third choice to disable both fields. It
seems
like maybe If...Then...Else could be used in some way I'm just unsure
exactly
how.

P.S. If my question is confusing let me know and I'll try to rephrase it.
--
julostarr


"Jeff Boyce" wrote:

I don't know why the expressioin didn't work ... did you get an error
message? Did you insert a breakpoint in the code so you could step
through
it one statement at a time and see what values were being returned?

Congratulations on a solution!

Regards

Jeff Boyce
Microsoft Office/Access MVP


"julostarr" wrote in message
...
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" wrote in message
...
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"

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]









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.