By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

Unbound Button Group

P: 166

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!
Jan 26 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 1,287
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
Expand|Select|Wrap|Line Numbers
  1. Dim strWhere as String
  3. Select Case OptionGroup  'the name of the whole Option Group
  4.     Case 1  'Note on which button this is
  5.         strWhere = "Test = 1"
  6.     Case 2  'Note on which button this is
  7.         strWhere = "Test = 2"
  8.     Case Else
  9.         MsgBox "Invalid Selection!"
  10.         Exit Sub
  11. End Select
  13. 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.
Jan 26 '09 #2

P: 166
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?

Jan 26 '09 #3

Expert 100+
P: 1,287
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.
Jan 26 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.