Unbound Button Group

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • csolomon
    New Member
    • Mar 2008
    • 166

    Unbound Button Group

    Hello:

    I am trying to set up unbound button group options to allow the user to select the value they would like to use on another form.

    In the process, the user has run several tests and he needs to decide which test results he will use. He will run at least one test and up to 10. My idea was the have the buttons (1-10) each representing a test ran. If for instance the user selects test 3 out of 7 tests, then he would select button 7 and the information pertaining to that test would populate on the next form.

    I have a query that returns the results for each each test in the group, but I am unsure how to make it work in conjunction with the buttons. I was thinking that I would need to code each button with an onclick event or maybe have one case statement. as I said my buttons are in a group, so could i have one case statement that corresponds to each button in the group? If this is how i can accomplish it, how do I set the buttons in VBA to correspond to the entries of the query?

    Thank you!
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    If you click on the actual buttons in design view, you can see their value under the Data tab -> Option Value. You could make your case statement like
    Code:
    Dim strWhere as String
     
    Select Case OptionGroup  'the name of the whole Option Group
        Case 1  'Note on which button this is
            strWhere = "Test = 1"
        Case 2  'Note on which button this is
            strWhere = "Test = 2"
        Case Else
            MsgBox "Invalid Selection!"
            Exit Sub
    End Select
     
    DoCmd.OpenForm "The Other Form", , , strWhere
    That is an example to set a filter for the form you open depending on the selection. You could use open arguments, or just open a whole different form in each Case if you wanted to.

    Comment

    • csolomon
      New Member
      • Mar 2008
      • 166

      #3
      My plan is for each button to correspond to a row in the query and for instance if you click option 2, the form will open with all of the information related to selection 2

      Is this possible?

      Thanks

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        If your form is based on the query, then the code that I have given you is exactly what you want. It opens the form with it filtered to the record that you specify according to the option selected. If you need more help, you can post the query that the form is based on, and the criteria you will use to select a row in the query.

        Comment

        Working...