Results 1 to 13 of 13
  1. #1
    Join Date
    Apr 2015
    Posts
    8

    Question Unanswered: How to use option groups.

    Ive been looking, but I have not found any were that explains to me how to use option groups, its very, very annoying, and surprising that I cant find it. Any links, charts, date base test, that show me what to do would be greatly appreciated. Thanks!



    FYI I'm using Microsoft Access 2010. I am trying to link the option group to a list box named "TblShows" that gets its information from a query named "qryEvents" if that helps any.

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    496
    Provided Answers: 24
    Option groups use the frame they are in.

    Draw a frame, Name it...say: FraVals
    then put your option btns in.
    Assign a value to each btn. (Properties)

    When an option is picked then the value is assigned to the frame....
    FraVals.value

  3. #3
    Join Date
    Apr 2015
    Posts
    8

    Not sure

    What is the VBA code I would use for it?

  4. #4
    Join Date
    Apr 2015
    Posts
    8

    What I do

    When I create a option button with the wizard, the first options are the names, I type them in. Then there is what option I would like to be the default option, I choose none. Next option is the values (only numbers so I leave them default) then there is the button style, I also leave it default. Then there is a name for the option button. Again, default. Thats all the options I have. What do I do after that to tie it to my list box "lstItems?"

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    First, note that the name you enter is a Caption to be displayed on the Form for the OG, not its name! Access will assign something like Frame0 for the name.

    Not at all sure what you mean by "trying to link the option group to a list box;" you need to explain that more clearly.

    The tricky part is referring to the selection. To do that you refer to the name of the Option Group Control (Access will assign something like Frame0) not the name of the individual Radio Buttons or Checkboxes. So if you, say, have Labels

    • Hand Guns
    • Shotguns
    • Rifles
    • Mortars

    They will return, in order

    • 1
    • 2
    • 3
    • 4

    Then, in code, you would then refer to the Option Group something like this

    Code:
    Select Case Me.Frame0 
      
      Case 1
       
       'What to do if Hand Guns is selected
       
      Case 2
       
       'What to do if Shotguns is selected   
      
      Case 3
       
       'What to do if Rifles is selected
       
      Case 4
       
       'What to do if Mortars is selected   
    
    End Select


    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Apr 2015
    Posts
    8

    were do I put it?

    Were do I put that code? And would that code then sort my list box into those category's?

    Would I put it in the "On Click?" didn't see a "On select in the property's of the option group.

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    If you want the code to run immediately after making the selection, you can use the OnClick event, I believe, although most developers use the AfterUpdate event of the Option Group Control.

    Once again, you need to explain, in plain language, what you mean by "trying to link the option group to a list box."

    Linq ;0)>
    Last edited by Missinglinq; 04-24-15 at 12:33.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Join Date
    Apr 2015
    Posts
    8

    Linking

    Well, how do I tell the option group that the options in it are the category's in the list box? Because I need to limit the list box to those category's that I pick.

  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    y'don't
    option groups are a way of displaying a very limited range of choices to a users, usually using the radio button control.
    if you have more that a few options then use a list or combo box instead.
    list or combo boxes can allow for mutli choice selections and can allow users to add rows... radio buttons can't.


    so if its a simple choice then an option group of radio buttons within a frame works. if its an open ended list of options then use a list or comb or box
    I'd rather be riding on the Tiger 800 or the Norton

  10. #10
    Join Date
    Apr 2015
    Posts
    8

    Uhh...

    Well, I am not sure. I want to sort the thing. How about this, I have 6 item, each item has a category, one category is current, and the 2nd is retired. I want the option group to to have 2 options. One is Retired, and the 2nd one is current in the option group. If I select the option group Retired, I only want the see the items that have the category Retired. Is that what the option group should be able to do? And if so, how do I do that?

  11. #11
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so your choices are:-
    either use an option group with radio buttons for each of the specified options

    OR

    use a list or combo box., pulling the values for the list/combobox from a table, but binding the list/combvox to the column in the table that should store this value

    in either case the wizards should do most of the spadework for you.

    of the two the latter would be my personal preference. why...
    ...using a combo /lit box, pulling the values from a table measn that if there is need for another option then change the data and its immediately available.
    adding to an option group is tricky (you need to revisist every form that uses this option group and implement design changes.
    I'd rather be riding on the Tiger 800 or the Norton

  12. #12
    Join Date
    Apr 2015
    Posts
    8

    Ok

    Ok, how would I set that up? I got the combo box, with it getting its info from from the same table as the list box. How would I set it up so its tied to the list box?

  13. #13
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you already have a list box that is bound to a column in the underlying query AND uses another table as its rowsource, then effectively you have already got an implementation of an option group
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •