making option groups visible/invisible based on another option group selection

E

Emma

I have a form on which there are 3 option groups. my
first option group determines which of two other options
groups will be visible to to user. I have placed the
following code in the afterupdate event of the first
option group. I know it's wrong. Can someone help me out
with the correct code?

Private Sub Request_Type_Frame_AfterUpdate()
'Hide or Unhide Purpose Frame
'Request Type either 1 or 2
Select Case Request_Type_Frame(Request_Type)
'If Request_Type is 1 Show only Sponsorship frame and hide
Consulting frame
Case 1 Sponsorship_Purpose_Frame.Visible

'...I'm not sure how to make the Consulting_Purpose_Frame
invisible here
Consulting_Purpose_Frame.Visible = False

'If Request_Type is 2 show only Consulting Frame and hide
sponsorship frame
Case 2 Consulting_Purpose_Frame.Visible = true

'...same here for the Sponsorship_Purpose_Frame here
Sponsorship_Purpose_Frame.Visible = False

End Select
End Sub

Your help is much appreciated!!

Emma
 
D

Dirk Goldgar

Emma said:
I have a form on which there are 3 option groups. my
first option group determines which of two other options
groups will be visible to to user. I have placed the
following code in the afterupdate event of the first
option group. I know it's wrong. Can someone help me out
with the correct code?

Private Sub Request_Type_Frame_AfterUpdate()
'Hide or Unhide Purpose Frame
'Request Type either 1 or 2
Select Case Request_Type_Frame(Request_Type)
'If Request_Type is 1 Show only Sponsorship frame and hide
Consulting frame
Case 1 Sponsorship_Purpose_Frame.Visible

'...I'm not sure how to make the Consulting_Purpose_Frame
invisible here
Consulting_Purpose_Frame.Visible = False

'If Request_Type is 2 show only Consulting Frame and hide
sponsorship frame
Case 2 Consulting_Purpose_Frame.Visible = true

'...same here for the Sponsorship_Purpose_Frame here
Sponsorship_Purpose_Frame.Visible = False

End Select
End Sub

Your help is much appreciated!!

Emma

Try this:

'------ start of revised code -----
Private Sub Request_Type_Frame_AfterUpdate()

'Hide or Unhide Purpose Frames

Select Case Me!Request_Type_Frame

Case 1
' Show only Sponsorship frame and hide
' Consulting frame
Me!Sponsorship_Purpose_Frame.Visible = True
Me!Consulting_Purpose_Frame.Visible = False

Case 2
' Show only Consulting Frame and hide
' sponsorship frame
Me!Consulting_Purpose_Frame.Visible = True
Me!Sponsorship_Purpose_Frame.Visible = False

End Select

End Sub
'------ end of revised code -----
 
E

Emma

You are wonderful!!!
-----Original Message-----


Try this:

'------ start of revised code -----
Private Sub Request_Type_Frame_AfterUpdate()

'Hide or Unhide Purpose Frames

Select Case Me!Request_Type_Frame

Case 1
' Show only Sponsorship frame and hide
' Consulting frame
Me!Sponsorship_Purpose_Frame.Visible = True
Me!Consulting_Purpose_Frame.Visible = False

Case 2
' Show only Consulting Frame and hide
' sponsorship frame
Me!Consulting_Purpose_Frame.Visible = True
Me!Sponsorship_Purpose_Frame.Visible = False

End Select

End Sub
'------ end of revised code -----

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