How to check if an option button is selected.

randommetalguy

Registered User.
Local time
Today, 14:39
Joined
Nov 25, 2008
Messages
52
I have 2 option buttons what do I have to do to get different code to run based on which option button I select. Right now I have

if option1.checked = True then
.....
elseif option2.checked = True then
......
endif

Checked isn't working and neither did value or enabled so what do I need to have?
 
I have 2 option buttons what do I have to do to get different code to run based on which option button I select. Right now I have

if option1.checked = True then
.....
elseif option2.checked = True then
......
endif

Checked isn't working and neither did value or enabled so what do I need to have?
Don't use individual option buttons. Use an OPTION GROUP as you can then just get the value of it and tell which option is chosen, plus it manages it so that only one option can be chosen at a time.
 
As Bob has said, assuming you only want one of the options to be true, use an Option Group. There is no such Property as "checked" and Enabled is not appropriate for this. The Value Property is the correct one to use, and if you tried this, it should have worked assuming you had it placed in the appropriate event. Exactly where do you have this code placed?

Also note that in an Option Group, you refer to the Value of the Option Group, not an individual button. Access, by Default, will name the group Framen where the n is a number.
 

Users who are viewing this thread

Back
Top Bottom