Option Groups (1 Viewer)

TVReplay99

Registered User.
Local time
Today, 18:48
Joined
Jan 2, 2002
Messages
29
Hello, I am a first time user.
I am using a form to print several different sizes of labels(different reports) based off the same criteria in a combo box on the same form. I am trying to use an option group to select the different report (label size) to print. I tried using code to show the correct button to pres to print the label selected and hide the others. I am sure this is basic but any help would be much appreciated.
 

Jack Cowley

Registered User.
Local time
Today, 18:48
Joined
Aug 7, 2000
Messages
2,639
In the After Update event of your Option Group use code similar to this"

Select Case Me.OptionGroupName
Case 1
Me.Button1.Visible = True
Me.Button2.Visible = False
Me.Button3.Visible = False
Case 2
Me.Button1.Visible = False
Me.Button2.Visible = True
Me.Button3.Visible = False
Case 3
Me.Button1.Visible = False
Me.Button2.Visible = False
Me.Button3.Visible = True
End Select

Change the names above to the correct names for your Command buttons and your Option Group.
 

TVReplay99

Registered User.
Local time
Today, 18:48
Joined
Jan 2, 2002
Messages
29
This is the code I used:
Private Sub Frame54_AfterUpdate()
Select Case Me!Frame54
Case 1
Me!btnUPS.Visible = True
Me!btn2.Visible = False
Me!btn6.Visible = False
Me!btn10.Visible = False
Me!btn30.Visible = False
Case 2
Me!btnUPS.Visible = False
Me!btn2.Visible = True
Me!btn6.Visible = False
Me!btn10.Visible = False
Me!btn30.Visible = False
Case 6
Me!btnUPS.Visible = False
Me!btn2.Visible = False
Me!btn6.Visible = True
Me!btn10.Visible = False
Me!btn30.Visible = False
Case 10
Me!btnUPS.Visible = False
Me!btn2.Visible = False
Me!btn6.Visible = False
Me!btn10.Visible = True
Me!btn30.Visible = False
Case 30
Me!btnUPS.Visible = False
Me!btn2.Visible = False
Me!btn6.Visible = False
Me!btn10.Visible = False
Me!btn30.Visible = True
End Select
End Sub

I created the Option Group with the wizard and named it optLabels but in the VB code builder it sees it as Frame54. The following is th error I recieve.
"The expression After Update you entered as the event property setting produced the following error: A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control.
*The expression may not result inthge name of a macro, the name of a user-defined function, or[Event Procedure].
*There may have been and error evalualting the function, event, or macro."
 

TVReplay99

Registered User.
Local time
Today, 18:48
Joined
Jan 2, 2002
Messages
29
I just saw that I had "!" instead ot "." but still get the error. Thank you for your help.
 

Jack Cowley

Registered User.
Local time
Today, 18:48
Joined
Aug 7, 2000
Messages
2,639
I think your problem is not with the code but something else. Open any code page where you see the Debug menu. Click on Tools > References and see if any items are marked "MISSING". If so, uncheck them and try your code again....
 

TVReplay99

Registered User.
Local time
Today, 18:48
Joined
Jan 2, 2002
Messages
29
Jack,
Nothing I tried worked other than deleting and creating a new form. Now everything works. Thank you very much for your help.
Brian
 

Jack Cowley

Registered User.
Local time
Today, 18:48
Joined
Aug 7, 2000
Messages
2,639
Brian,

Sometimes ya just have to bite the bullet and that is what you did and it worked. Glad all is working as it should now.
 

Users who are viewing this thread

Top Bottom