Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

check if radio button is selected

I have a form with  two radio buttons and a command button that activates a certain event. The user will naturally make a choice from either one of the radio buttons and click the command.
Question:
How do i place code on that event (command button) that displays a message in the case that the user does not choose either of the radio buttons ??

Thanks a million !
0
Dayim
Asked:
Dayim
  • 2
1 Solution
 
flavoCommented:
private sub cmdMyButton_click()

If Me.myOption1.value =  0 and Me.myOption2.value  = 0 then
   'neither are selected
    Msgbox "Nooo!!!!"

else
    'what ever you do
end if

end sub
0
 
DayimAuthor Commented:
My friend, this is how the rest of the radio buttons work :

If Me!Frame0 = 1 Then
' closes frmAll-Indiv

ElseIf Me!Frame0 = 2 Then

End If

.......................................

0
 
DayimAuthor Commented:
Ignore, previous thread ...
My friend, this is how the radio buttons code look in my application :

If Me!Frame0 = 1 Then
' closes frmAll-Indiv

ElseIf Me!Frame0 = 2 Then

End If
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Select Case Me.Frame0.Value
    Case 1
        'Close frmAll-Indiv

    Case 2
        'Do whatever

    Case Else
        msgbox "Whatever message you want to display to the user when nothing is selected."

end select
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now