473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to use the option buttons in VBA

how to use the option buttons in VBA (how to call the value of the option buttons ) and is it must to gather the option buttons in one option group ?

thanks
Jul 22 '08 #1
1 46129
missinglinq
3,532 Expert 2GB
You use an Option Group if you want to limit your user to one option out of a group of options! Only one option at a time can be selected from an option group. When you create an Option Group, the group is given a name such as Frame0 or Frame2. This is how you must refer to the group; when a value is chosen, such as the third button or option, that is the value of the Frame or Option Group. Each button, when clicked, assigns its value to the Frame or Option Group. The first button is assigned 1, the second button 2, and so forth. You cannot directly assign text values to an Option Group. Here's an example that pops up an message box telling you which button in an Option Group has been selected:
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourFrameName_AfterUpdate()
  2.   Select Case YourFrameName
  3.     Case 1
  4.       MsgBox "First Button"
  5.     Case 2
  6.       MsgBox "Second Button"
  7.     Case 3
  8.       MsgBox "Third Button"
  9.   End Select
  10. End Sub
An individual button, one not in an Option Group, is referred to in this manner:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OptionButton_AfterUpdate()
  2.  If OptionButton = -1 Then
  3.    MsgBox "Button is Checked!"
  4.  Else
  5.    MsgBox "Button is Not Checked!"
  6.  End If
  7. End Sub
  8.  
Hope this helps!

Linq ;0)>
Jul 22 '08 #2

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

Similar topics

3
by: Edward | last post by:
I have a data entry form that allows the user to navigate around entirely using the keyboard. However, it contains various option button controls which are in the tab order. Whenever they are...
5
by: Saxman | last post by:
I created a text box labeled txtText1. The text box has a sample of text within. The Enabled property is set to False and the Multiline property set to True. I have four option buttons set...
2
by: PM | last post by:
I have a question about option buttons and their values. I have many option buttons on my forms, each set contained in their own group boxes. I simply want to be able to give them a value,...
2
by: Omey Samaroo | last post by:
I have had many questions answered in this forum and I am trusting that one of the readers may help me find a simple solution. (1) Using a field called Date_Hired (type: Date/Time), how do I use...
0
by: Robert | last post by:
Stephen, I think I figured out the problem. I was able to get Check Boxes and Option Buttons to work on my form by TURNING OFF RECORD SELECTORS on the form. Not sure why this would make a...
5
by: tsnyder | last post by:
I need to have an option button that allows editing to a field only when it is checked.
1
by: MAIjah | last post by:
Sorry, just a newbie and what I call a 'bruteforce' programmer. I'm using a VBform in EXCEL to pass info to a worksheet. I have 7 option buttons (exclusive?, only one can be true) and want to...
21
beacon
by: beacon | last post by:
Hello to everybody, I have a section on a form that has 10 questions, numbered 1-10, with 3 option buttons per question. Each of the option buttons have the same response (Yes, No, Don't know),...
2
beacon
by: beacon | last post by:
Hi everybody, I have a form that has a combo box that asks the user to select the program they work on. Once the user selects the program, a SQL statement populates the row source for 4 staff...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.