Using Toggle/Option Buttons

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I put two option buttons on a form and I am trying to figure out how to use them. Where is the Value stored when one of the Options are selected? I want to use these buttons in an If statement.

Option246
Option248

I tired to test it:
Private Sub Frame244_Click()
If Option246.Value = "1" Then
Text256.Value = "1"
Else
Text256.Value = "2"
End If
End Sub

No luck, I get debug error
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Re: Access: Using Toggle/Option Buttons

I think toggle boxes are either 0 or -1, not 1 or 2.

Also, i don’t think you should use the quote marks, so Option246.value = 0 then yadda yadda yadda
 
Upvote 0
Re: Access: Using Toggle/Option Buttons

The value is assigned to the frame control:

Code:
Private Sub Frame244_Click()
Select Case Frame244
    Case Is = 1
        Text256 = "1"
    Case Is = 2
        Text256 = "2"
End Select    
End Sub

Or

Code:
Private Sub Frame244_Click()
Text256 = Frame244
End Sub

Note that you can view and amend the option numbers on the property sheet of the option control.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,126
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top