Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Group Making Combo Box Visible 1

Status
Not open for further replies.

McHooty

Technical User
May 23, 2011
6
GB
Hi
I have a No/Yes Option Group which defaults to No but when Yes is selected makes a Combo Box and two Command Buttons visible.
All works so far (code below).
My problem is twofold;
1) If I choose Yes on a record and then navigate to another record the Combo Box and Command Buttons are visible there irrespective of the No/Yes option.
2) If I close the database and start a new session the Combo Box and Command Buttons are not visible even if Yes is highlighted as being selected previously.
Any help would be greatly appreciated as I am stumped.

McHooty

Private Sub Frame221_AfterUpdate()

With Me.Collection_Name_Combo
Select Case Me.Frame221.Value
Case 1 'Yes
.Visible = True
Case 2 'No
.Visible = False

End Select
End With

With Me.Collection_Name_Combo_Label
Select Case Me.Frame221.Value
Case 1 'Yes
.Visible = True
Case 2 'No
.Visible = False

End Select
End With

With Me.Add_Collection
Select Case Me.Frame221.Value
Case 1 'Yes
.Visible = True
Case 2 'No
.Visible = False

End Select
End With

With Me.Display_Collections
Select Case Me.Frame221.Value
Case 1 'Yes
.Visible = True
Case 2 'No
.Visible = False

End Select
End With
End Sub
 
What do you have in:

Code:
Private Sub Opt[blue]Yes[/blue]_Click()
[red]???[/red]
End Sub

Private Sub Opt[blue]No[/blue]_Click()
[red]???[/red]
End Sub

or whatever you call your option buttons.

Have fun.

---- Andy
 
I expect you need to call the Frame221_AfterUpdate in the On Current event of the form. Also, consider simplifying your code to:

Code:
Private Sub Frame221_AfterUpdate()
    Me.Collection_Name_Combo.Visible = (Me.Frame221 = 1)
    Me.Collection_Name_Combo_Label.Visible = (Me.Frame221 = 1)
    Me.Add_Collection.Visible = (Me.Frame221 = 1)
    Me.Display_Collections.Visible = (Me.Frame221 = 1)
End Sub

You might also rename Frame221 while you are modifying your code.

Duane
Hook'D on Access
MS Access MVP
 
Hi dhookom
Many, many thanks for the solution.
The coding advice much appreciated also.
Up and running ok now [pc2]
Mchooty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top