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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Active, Inactive textboxes



 
 
Thread Tools Display Modes
  #1  
Old August 6th, 2008, 08:08 PM posted to microsoft.public.access.forms
AccessDB
external usenet poster
 
Posts: 23
Default Active, Inactive textboxes

I have a form needs to be filled out. A lot of the questions are a yes/
no question. When they pick yes I want some other textboxes to be
active, and when they pick no I want the textboxes to be inactive.
Example - A question could be: Do you have siblings. If you check yes,
then other line would appear to say How many (other textboxes are
active)? If you say no, then it skips to the next question (other
textboxes are inactive - greyed out).
How do I do this? If it includes coding, can I get help with the
coding.
  #2  
Old August 6th, 2008, 10:36 PM posted to microsoft.public.access.forms
Piet Linden
external usenet poster
 
Posts: 11
Default Active, Inactive textboxes

On Aug 6, 2:08*pm, AccessDB wrote:
I have a form needs to be filled out. A lot of the questions are a yes/
no question. When they pick yes I want some other textboxes to be
active, and when they pick no I want the textboxes to be inactive.
Example - A question could be: Do you have siblings. If you check yes,
then other line would appear to say How many (other textboxes are
active)? If you say no, then it skips to the next question (other
textboxes are inactive - greyed out).
How do I do this? If it includes coding, can I get help with the
coding.


in the afterupdate of your checkbox, set the Enabled property of the
relevant textboxes.

Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=(MyCheckBox=Checked)
Me.txt2.Enabled=Not (MyCheckBox=Checked)
End Sub
  #3  
Old August 7th, 2008, 06:38 PM posted to microsoft.public.access.forms
AccessDB
external usenet poster
 
Posts: 23
Default Active, Inactive textboxes

On Aug 6, 4:36*pm, Piet Linden wrote:
On Aug 6, 2:08*pm, AccessDB wrote:

I have a form needs to be filled out. A lot of the questions are a yes/
no question. When they pick yes I want some other textboxes to be
active, and when they pick no I want the textboxes to be inactive.
Example - A question could be: Do you have siblings. If you check yes,
then other line would appear to say How many (other textboxes are
active)? If you say no, then it skips to the next question (other
textboxes are inactive - greyed out).
How do I do this? If it includes coding, can I get help with the
coding.


in the afterupdate of your checkbox, set the Enabled property of the
relevant textboxes.

Sub MyCheckBox_AfterUpdate()
* * Me.txt1.Enabled=(MyCheckBox=Checked)
* * Me.txt2.Enabled=Not (MyCheckBox=Checked)
End Sub


I'm new to coding so in your code Me.txt1.Enabled=(MycheckBox=Checked)
- is the txt1 the name of my textbox on my form? If so, then what is
the second line of code for?
  #4  
Old August 7th, 2008, 08:38 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Active, Inactive textboxes

Piet's code assumes you have two text boxes (one named txt1, one named txt2)
and that you want txt1 to be enabled when the check box (named MyCheckBox)
is checked and disabled when it's not checked. and that you want txt2 to be
disabled when the check box is not checked and enabled with it is. Change
the names of MyCheckBox, txt1 and txt2 as appropriate.

However, there's a mistake in the code.

It should simply be

Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=Me.MyCheckBox
Me.txt2.Enabled=Not Me.MyCheckBox
End Sub

Check boxes are either True or False. There's no reason for a variable named
Checked.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"AccessDB" wrote in message
...
in the afterupdate of your checkbox, set the Enabled property of the
relevant textboxes.

Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=(MyCheckBox=Checked)
Me.txt2.Enabled=Not (MyCheckBox=Checked)
End Sub


I'm new to coding so in your code Me.txt1.Enabled=(MycheckBox=Checked)
- is the txt1 the name of my textbox on my form? If so, then what is
the second line of code for?


  #5  
Old August 7th, 2008, 08:54 PM posted to microsoft.public.access.forms
AccessDB
external usenet poster
 
Posts: 23
Default Active, Inactive textboxes

On Aug 7, 2:38*pm, "Douglas J. Steele"
wrote:
Piet's code assumes you have two text boxes (one named txt1, one named txt2)
and that you want txt1 to be enabled when the check box (named MyCheckBox)
is checked and disabled when it's not checked. and that you want txt2 to be
disabled when the check box is not checked and enabled with it is. Change
the names of MyCheckBox, txt1 and txt2 as appropriate.

However, there's a mistake in the code.

It should simply be

Sub MyCheckBox_AfterUpdate()
* Me.txt1.Enabled=Me.MyCheckBox
* Me.txt2.Enabled=Not Me.MyCheckBox
End Sub

Check boxes are either True or False. There's no reason for a variable named
Checked.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)

"AccessDB" wrote in message

...

in the afterupdate of your checkbox, set the Enabled property of the
relevant textboxes.


Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=(MyCheckBox=Checked)
Me.txt2.Enabled=Not (MyCheckBox=Checked)
End Sub


I'm new to coding so in your code Me.txt1.Enabled=(MycheckBox=Checked)
- is the txt1 the name of my textbox on my form? If so, then what is
the second line of code for?


Thank you it works. But how do I have the questions below the Yes/No
question to be Disabled/Inactive until I pick Yes.
Example: First question - Do you have any any siblings?
Second question - How many
I want the "How Many" question to be Disabled/Inactive until Yes is
picked.
Here is my actual code so far:
Sub txtIs_AfterUpdate()
Me.txtApplication.Enabled = Me.txtIs
End Sub

What do I need in addition to the code to make this work.
  #6  
Old August 7th, 2008, 10:18 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Active, Inactive textboxes

In the form's Current event, set the Enabled property for all of the
relevant controls to False.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"AccessDB" wrote in message
...
On Aug 7, 2:38 pm, "Douglas J. Steele"
wrote:
Piet's code assumes you have two text boxes (one named txt1, one named
txt2)
and that you want txt1 to be enabled when the check box (named MyCheckBox)
is checked and disabled when it's not checked. and that you want txt2 to
be
disabled when the check box is not checked and enabled with it is. Change
the names of MyCheckBox, txt1 and txt2 as appropriate.

However, there's a mistake in the code.

It should simply be

Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=Me.MyCheckBox
Me.txt2.Enabled=Not Me.MyCheckBox
End Sub

Check boxes are either True or False. There's no reason for a variable
named
Checked.

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)

"AccessDB" wrote in message

...

in the afterupdate of your checkbox, set the Enabled property of the
relevant textboxes.


Sub MyCheckBox_AfterUpdate()
Me.txt1.Enabled=(MyCheckBox=Checked)
Me.txt2.Enabled=Not (MyCheckBox=Checked)
End Sub


I'm new to coding so in your code Me.txt1.Enabled=(MycheckBox=Checked)
- is the txt1 the name of my textbox on my form? If so, then what is
the second line of code for?


Thank you it works. But how do I have the questions below the Yes/No
question to be Disabled/Inactive until I pick Yes.
Example: First question - Do you have any any siblings?
Second question - How many
I want the "How Many" question to be Disabled/Inactive until Yes is
picked.
Here is my actual code so far:
Sub txtIs_AfterUpdate()
Me.txtApplication.Enabled = Me.txtIs
End Sub

What do I need in addition to the code to make this work.


 




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 09:19 AM.


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