How to gray-out a question dialog box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top