option buttons:display message: "you must choose an Option"

topUKlawyer
topUKlawyer used Ask the Experts™
on
I have an OK button which activates a procedure.

Before the button is pressed there are two groups of Option buttons.

Until now I have declared the first button in the group as a default button


But Now I want to change it so that if NO option is pressed in EACH group the user

gets a message box to say "you must choose one option from BOTH groups before pressing the OK button"

How do I do this?


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
topUKlawyer - Please upload your file - Patrick

Author

Commented:
uploaded

the options appear on two user forms

saleand purchase-purchase
and
purchase only


current.xls
attached is an example with the Purchase_Only form.

I am not sure what you are trying to achieve, but if there is no default option it may be better to use checkboxes (if multiple options are possible) or create a 'none' default option (if only 1 option is possible at a time)

also, you should combine your 4 form varieties and show the controls depending on your form type
current-modified1.xls
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Author

Commented:
Thanks will look at these and reply shortly.

i was trying to make sure that one or both of the options groups was not "overlooked" when the Ok button was fired up.

Author

Commented:
Thanks, Can you just explain by what you meant by

~also, you should combine your 4 form varieties and show the controls depending on your form type"

Have I got too many forms?

your forms are messy, you have exactly the same content  copied 4 times, which makes standardisation harder and duplicates code.

just look at your discount 10% option, which has 4 different texts across the 4 forms.
and by messy, I mean functionality messy
topUKlawyer,

1. Place the radio buttons in named groups in a frame
2. Make all radio button False
3. Check for what has been selected
4. If selection not made then remind user, if not exit sub but don't hide Userform

It's in the attached file for the 'purchase' tab.

Hope it helps

Patrick
Private Sub OKButtonPOnly_Click()

If minus10 = True Or standard0 = True Then
    If plus10 = True Or plus20 = True Or plus30 = True Then
        If minus10 Then
            Range("A3").Value = "ref 0.9"
             Call PurchaseOnlyCosts(P2Modifier:=0.9)
            
            ElseIf standard0 Then
            Range("A3").Value = "ref 1.0"
             Call PurchaseOnlyCosts(P2Modifier:=1)
            
            ElseIf plus10 Then
            Range("A3").Value = "ref 1.1"
             Call PurchaseOnlyCosts(P2Modifier:=1.1)
            
            ElseIf plus20 Then
            Range("A3").Value = "ref 1.2"
             Call PurchaseOnlyCosts(P2Modifier:=1.2)
             
            ElseIf plus30 Then
            Range("A3").Value = "ref 1.3"
             Call PurchaseOnlyCosts(P2Modifier:=1.3)
        End If
    Else
        MsgBox "Options in both the Cost Basis and Mortgage Basis must be selected." & vbCrLf & "Please make the selections and then press OK again"
        Exit Sub
    End If
Else
    MsgBox "Options in both the Cost Basis and Mortgage Basis must be selected." & vbCrLf & "Please make the selections and then press OK again"
    Exit Sub
End If
 
 If Charn Then
    Range("B11").Value = 104
    Range("C11").Value = "Charnwood:Local Search"
    
    ElseIf MM Then
    
    Range("B11").Value = 110
    Range("C11").Value = "Melton Mowbray:Local Search"
    
    ElseIf LC Then
    Range("B11").Value = 60
    Range("C11").Value = "Leicester City:Local Search"
 End If
  
End Sub

Open in new window

current-conveyancing-01.xls
ps In the file I uploaded I've tidied up the Userform - see screenshot below.

Patrick
MWSnap-016-2010-10-16--12-54-47.jpg

Author

Commented:
Many thanks

From the various options and possibilites you have kindly suggested i have opted for an extra option for each group which states "no option selected'

This is given a default value of true so if the OK button is pressed the user gets a message:

"Please select a costs option" OR "please select a local authority"

 (depending on which group has not been selected.)

This works well and thank you for your very helpful input

Author

Commented:
helpful and swift response
topUKlawyer,

Thanks for the grade. Pleased it helped you solve the problem.

Patrick

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial