Option Groups

NUWildcat

Registered User.
Local time
Today, 05:28
Joined
Apr 16, 2002
Messages
17
How do you create an option group from a group of option buttons? I want to know how to have the user only be able to choose one of the options on the form at a time.
Does anyone have any ideas? Thanks.
 
In design view of the form, make sure the little button that has the magic wand is in the depressed position. Then select the OPTION Group button, which looks like a frame with XYZ at the top.

Click on it, and it will open the wizard. Then you can answer the questions as it goes and it will help you build the option group. The first thing up will be to put in the labels you want for each option, then it will ask you if you want one as DEFAULT, Then you can select what value each box will be, then you can either bind it to a field, or save it for later use.

Then it will let you choose the visual format and then ask you for the label caption for the option group.

After you have it on your form, you can select how you use it. I usually go into the name property (click on the border around the option buttons) and name it something like optMyOptionGroup. Don't bother with each button name. Then, let's say that you want to click a button and have it do something based on what button was selected. You can have code on the button that goes something like this:

Private Sub cmdMyButton_Click()
Select Case optMyOptionGroup
Case 1
Docmd.OpenReport "MyReport1", acNormal
Case 2
Docmd.OpenReport "MyOtherReport", acPreview
End Select
End Sub

Hope that helps.

BL
End Sub

[This message has been edited by boblarson (edited 04-22-2002).]
 
There are 2 ways of doing this.
1> you can use the option group button from the toolbar to create an option group. Follow the wizard to input the name of the labels etc manually.

2> You can insert a frame using the same option group button but without the wizard working. with this method you have to manually insert your option buttons or check boxes.

Option buttons inherently mean that you can only choose 1 of the options within the frame.

you can set a number of frames on the same form each with there own option group.

remember that the form itself is classed as framed and therefore option buttons can be inserted directly onto the form. However i recomend the use of the frames to group your options together.

It is also possible to set a default option button, so even if the user doesnt change an option 1 will automatically be selected.

Someone else may give you better advice but i hope this helps.

ian
 

Users who are viewing this thread

Back
Top Bottom