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

Getting a Value from an Option Group

P: 44
I created a group of option buttons using the wizard. Now I want to decide which action to take based on which option was selected, I can't seem to find the syntax testing which button is selected. I thought maybe something like:
"IF [Forms]![Form Name]![Option Button Name]=1 THEN..."
would work, but it says I entered an expression that has no value.
Sep 20 '07 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,597
I created a group of option buttons using the wizard. Now I want to decide which action to take based on which option was selected, I can't seem to find the syntax testing which button is selected. I thought maybe something like:
"IF [Forms]![Form Name]![Option Button Name]=1 THEN..."
would work, but it says I entered an expression that has no value.
Assuming your Option Group Name is optTest, and you went with the Default Values (1 to 6) for each Option:
Expand|Select|Wrap|Line Numbers
  1. Select Case Me![optTest]
  2.   Case 1
  3.     MsgBox "You chose Option 1"
  4.   Case 2
  5.     MsgBox "You chose Option 2"
  6.   Case 3
  7.     MsgBox "You chose Option 3"
  8.   Case 4
  9.     MsgBox "You chose Option 4"
  10.   Case 5
  11.     MsgBox "You chose Option 5"
  12.   Case 6
  13.     MsgBox "You chose Option 6"
  14. End Select
Sep 21 '07 #2

P: 44
Assuming your Option Group Name is optTest, and you went with the Default Values (1 to 6) for each Option:
Expand|Select|Wrap|Line Numbers
  1. Select Case Me![optTest]
  2.   Case 1
  3.     MsgBox "You chose Option 1"
  4.   Case 2
  5.     MsgBox "You chose Option 2"
  6.   Case 3
  7.     MsgBox "You chose Option 3"
  8.   Case 4
  9.     MsgBox "You chose Option 4"
  10.   Case 5
  11.     MsgBox "You chose Option 5"
  12.   Case 6
  13.     MsgBox "You chose Option 6"
  14. End Select


Yep, that does the trick. Thanks.
Sep 21 '07 #3

ADezii
Expert 5K+
P: 8,597
Yep, that does the trick. Thanks.
You are quite welcome.
Sep 21 '07 #4

Post your reply

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