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

How to gray-out a question dialog box



 
 
Thread Tools Display Modes
  #1  
Old October 23rd, 2004, 01:49 PM
S_Kaplan
external usenet poster
 
Posts: n/a
Default How to gray-out a question dialog box

I am a new user to Access and have been trying to figure out how to
accomplish the following:
On my form, I would like to have a field be either fillable or not fillable
based on the answer to the question that precedes it. For example, in my
form, I have a drop down box where a person selects their status which
includes among other choices, “Military Member.” If a person selects that
choice, I want the person to answer the next question which will be another
drop down box with each rank, from which they can choose the one that is
appropriate for them. Conversly, if a person answers the "status" question
with one of the drop down choices with anything other than “Military Member,”
I want the rank question and box to be “grayed-out” or not-fillable. Is
there a way to do this? I appreciate any help.


  #2  
Old October 23rd, 2004, 02:04 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default

In the AfterUpdate event of the first control, put logic to toggle the
Enabled property of the second control.

For instance, something like:

Private Sub cboStatus_AfterUpdate()

If Me.cboStatus = "Miltary Member" Then
Me.cboRank.Enabled = True
Else
Me.cboRank.Enabled = False
Else

End Sub

This assumes that cboStatus is bound to the text field, and not the ID of
the Status table: if the latter is the case, change what you're checking for
in the If statement. You can also make this even simpler using something
like:

Private Sub cboStatus_AfterUpdate()

Me.cboRank.Enabled = (Me.cboStatus = "Miltary Member")

End Sub

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



"S_Kaplan" wrote in message
...
I am a new user to Access and have been trying to figure out how to
accomplish the following:
On my form, I would like to have a field be either fillable or not

fillable
based on the answer to the question that precedes it. For example, in my
form, I have a drop down box where a person selects their status which
includes among other choices, "Military Member." If a person selects that
choice, I want the person to answer the next question which will be

another
drop down box with each rank, from which they can choose the one that is
appropriate for them. Conversly, if a person answers the "status"

question
with one of the drop down choices with anything other than "Military

Member,"
I want the rank question and box to be "grayed-out" or not-fillable. Is
there a way to do this? I appreciate any help.




  #3  
Old October 23rd, 2004, 02:09 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default

In the first combo box's AfterUpdate event, you can evaluate what was
chosen. If the "Military Member" item was chosen, you can enable the next
combo box. Code something like:

If Me!cboStatus.Column(1) = "Military Member" Then
Me!cboNextCombo.Enabled = True
Else
Me!cboNextCombo.Enabled = False
End If

Note that this assumes your combo box is set up with a "hidden" key value in
the first (bound) column and the text in the second -- the .Column(1) is
used because the Column() property is zero-based.

--
Good luck

Jeff Boyce
Access MVP

"S_Kaplan" wrote in message
...
I am a new user to Access and have been trying to figure out how to
accomplish the following:
On my form, I would like to have a field be either fillable or not

fillable
based on the answer to the question that precedes it. For example, in my
form, I have a drop down box where a person selects their status which
includes among other choices, “Military Member.” If a person selects that
choice, I want the person to answer the next question which will be

another
drop down box with each rank, from which they can choose the one that is
appropriate for them. Conversly, if a person answers the "status"

question
with one of the drop down choices with anything other than “Military

Member,”
I want the rank question and box to be “grayed-out” or not-fillable. Is
there a way to do this? I appreciate any help.



  #4  
Old October 26th, 2004, 12:11 AM
SKaplan
external usenet poster
 
Posts: n/a
Default

Thank you both for the help. I tried all three suggestions, but still didn't
have any effect. I apologize for my ignorance-I must be overlooking
something simple.
I have both the Status and Rank fields in the table. And have their own
"lookup values." In the form, both work fine, i.e., you can select from the
list of answers that drop down. I added a N/A choice to the list of rank
selections as a backup in case I can't get it to work like I described. If
you have any thoughts about what I might be missing, I'd sure appreciate it.
Thanks again,
Stewart

"Jeff Boyce" wrote:

In the first combo box's AfterUpdate event, you can evaluate what was
chosen. If the "Military Member" item was chosen, you can enable the next
combo box. Code something like:

If Me!cboStatus.Column(1) = "Military Member" Then
Me!cboNextCombo.Enabled = True
Else
Me!cboNextCombo.Enabled = False
End If

Note that this assumes your combo box is set up with a "hidden" key value in
the first (bound) column and the text in the second -- the .Column(1) is
used because the Column() property is zero-based.

--
Good luck

Jeff Boyce
Access MVP

"S_Kaplan" wrote in message
...
I am a new user to Access and have been trying to figure out how to
accomplish the following:
On my form, I would like to have a field be either fillable or not

fillable
based on the answer to the question that precedes it. For example, in my
form, I have a drop down box where a person selects their status which
includes among other choices, “Military Member.” If a person selects that
choice, I want the person to answer the next question which will be

another
drop down box with each rank, from which they can choose the one that is
appropriate for them. Conversly, if a person answers the "status"

question
with one of the drop down choices with anything other than “Military

Member,”
I want the rank question and box to be “grayed-out” or not-fillable. Is
there a way to do this? I appreciate any help.




 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
using the print dialog box Keith Perry Setting Up & Running Reports 1 September 3rd, 2004 11:46 AM
with ref to the dialog editor question DAVE P General Discussion 1 July 4th, 2004 06:14 PM
Date query in Dialog box question joe Running & Setting Up Queries 1 June 5th, 2004 12:52 AM


All times are GMT +1. The time now is 12:44 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.