Using Toggle/Option Buttons

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,332
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

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