radio/option buttons

  • Thread starter Thread starter vbnetman via AccessMonster.com
  • Start date Start date
V

vbnetman via AccessMonster.com

In VBA, how is the position of an option button determined? VB.Net would be
if testRadioButton. checked then...............

or in the case of check boxes....if checkbox1.checked = true then........

I do not see these available or am I missing something.

Thank you
 
Private Sub Command11_Click()

'Option0 is not contained in an option group.
If Me.Option0.Value <> 0 Then
MsgBox "'Option0' is selected."
Else
MsgBox "'Option0' is not selected."
End If

'Frame2 is an option group
'containing three option buttons.
Select Case Me.Frame2
Case 1
MsgBox "Option 'One' is selected."
Case 2
MsgBox "Option 'Two' is selected."
Case 3
MsgBox "Option 'Three' is selected."
Case Else
MsgBox "Hey! No fair adding buttons without telling me!"
End Select

End Sub
 
BTW: The Value property is the default property of an Access form control,
so 'If Me.Option0.Value <> 0 Then' is equivalent to 'If Me.Option0 <> 0
Then', and 'Select Case Me.Frame2' is equivalent to 'Select Case
Me.Frame2.Value'.

--
Brendan Reynolds
Access MVP

Brendan Reynolds said:
Private Sub Command11_Click()

'Option0 is not contained in an option group.
If Me.Option0.Value <> 0 Then
MsgBox "'Option0' is selected."
Else
MsgBox "'Option0' is not selected."
End If

'Frame2 is an option group
'containing three option buttons.
Select Case Me.Frame2
Case 1
MsgBox "Option 'One' is selected."
Case 2
MsgBox "Option 'Two' is selected."
Case 3
MsgBox "Option 'Three' is selected."
Case Else
MsgBox "Hey! No fair adding buttons without telling me!"
End Select

End Sub
 
Brendan said:
BTW: The Value property is the default property of an Access form control,
so 'If Me.Option0.Value <> 0 Then' is equivalent to 'If Me.Option0 <> 0
Then', and 'Select Case Me.Frame2' is equivalent to 'Select Case
Me.Frame2.Value'.
Private Sub Command11_Click()
[quoted text clipped - 29 lines]

Brendan,
That's the ticket! Works flawlessly. Thank you so much.
 
vbnetman said:
BTW: The Value property is the default property of an Access form control,
so 'If Me.Option0.Value <> 0 Then' is equivalent to 'If Me.Option0 <> 0
[quoted text clipped - 6 lines]
Brendan,
That's the ticket! Works flawlessly. Thank you so much.


Brendan,
One other thing...in your2nd example with the option group, how are the
individual option buttons referred to. If, for example I want to grey out
(enable = false) 2 of the three, how are those referred to...by individual
name?
 
Yes.

--
Brendan Reynolds
Access MVP


vbnetman via AccessMonster.com said:
vbnetman said:
BTW: The Value property is the default property of an Access form
control,
so 'If Me.Option0.Value <> 0 Then' is equivalent to 'If Me.Option0 <> 0
[quoted text clipped - 6 lines]
Thank you

Brendan,
That's the ticket! Works flawlessly. Thank you so much.


Brendan,
One other thing...in your2nd example with the option group, how are the
individual option buttons referred to. If, for example I want to grey out
(enable = false) 2 of the three, how are those referred to...by
individual
name?
 
Back
Top