Visibility dependent combo box

T

tm3025

On my form, I have two combo boxes. I want the second to be visible only if a
certain choice is made in the first combo box. In the second box, I set
visibility to No and entered the following code into the AfterUpdate Event:

Private Sub Grade_AfterUpdate()
If Me![Combo83] = "RCC" Then
Me![Grade].Visible = True
Else
Me![Grade].Visible = False
End If
End Sub

I saved this and returned to the form. However, my records that I have
previously entered do not show Grade even if RCC is selected. New records
also do not show Grade if RCC is entered. Not sure what's wrong here. Thanks
for your help.
 
D

Dirk Goldgar

tm3025 said:
On my form, I have two combo boxes. I want the second to be visible only
if a
certain choice is made in the first combo box. In the second box, I set
visibility to No and entered the following code into the AfterUpdate
Event:

Private Sub Grade_AfterUpdate()
If Me![Combo83] = "RCC" Then
Me![Grade].Visible = True
Else
Me![Grade].Visible = False
End If
End Sub

I saved this and returned to the form. However, my records that I have
previously entered do not show Grade even if RCC is selected. New records
also do not show Grade if RCC is entered. Not sure what's wrong here.
Thanks
for your help.


If it's the value of Combo83 that determines the visibility of Grade, then
it's the AfterUpdate event of Combo83, not of Grade, that should contain the
code. Also, to have this work for existing records where Combo83 has
already had its value selected, you must also use the form's Current event
to make the same test and set the visibility of Grade.
 
T

tm3025

Worked great, thanks for your help

Dirk Goldgar said:
tm3025 said:
On my form, I have two combo boxes. I want the second to be visible only
if a
certain choice is made in the first combo box. In the second box, I set
visibility to No and entered the following code into the AfterUpdate
Event:

Private Sub Grade_AfterUpdate()
If Me![Combo83] = "RCC" Then
Me![Grade].Visible = True
Else
Me![Grade].Visible = False
End If
End Sub

I saved this and returned to the form. However, my records that I have
previously entered do not show Grade even if RCC is selected. New records
also do not show Grade if RCC is entered. Not sure what's wrong here.
Thanks
for your help.


If it's the value of Combo83 that determines the visibility of Grade, then
it's the AfterUpdate event of Combo83, not of Grade, that should contain the
code. Also, to have this work for existing records where Combo83 has
already had its value selected, you must also use the form's Current event
to make the same test and set the visibility of Grade.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Top