Option buttons

Ecal

Registered User.
Local time
Today, 07:53
Joined
Nov 3, 2012
Messages
21
:banghead:
Hello, All
I am trying to create two option buttons Option32 and Option34 what I would like to happen is if both are clicked making them -1 a message to pop up and tell the user to choose either optionbutton not both. Then once the ok button displayed at the bottom of the message is pressed it resets both Option34 and Option32 to 0 or False respectively. However when just Option32 is choosen it pulls up another form to fill out. This is what I have thus far........ Have not gotten to the form part still kind of new to programming in visual basic so any help would be greatly appreciated. Thanks in Advance.

Private Sub Option32_AfterUpdate()
If Option34.Value = -1 & Option32.Value = -1 Then

Dim Msg, Style, Title, Help, Ctxt, Response
Msg = "Can not have both options chosen. Click Yes or No" ' Define message.
Style = vbOKOnly + vbCritical + vbDefaultButton1 + vbApplicationModal
' Define buttons.
Title = "Error" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbOKOnly Then ' User chose Yes.

Me.Option32.Value = 0
Me.Option34.Value = 0
End If
End If


End Sub

Not sure where I am going wrong compiled and everything but in the view form when I go to test it does not work.
 
just put the buttons in a option group. then they work as toggle radio buttons, and only one CAN be selected. that's the normal way of handling such buttons.
 
How do I do that is there an option for this? Heard of it before thinking that could be it but I did not see an option for it in properties.........
 
Ok, I see what your talking about. Now I just need to create code to open a different form when they select yes and store it in a table once completed.
 
Noticed you put an option group around each of the Option buttons seperately instead of together. Is there a reason for this or can I put one option group around both? Other than that this is exactly what I need I just need to re- adjust the code so that it opens my form.
 
Look at another way (as gemma-the-husky sey),
with OPTION GROUP. Open Form1 and try.
Adapt it as you want.
 

Attachments

Thanks for the help I appreciate it.:)
 
When you name Controls, Numbers are non descriptive.

234 is not as good as "Move" This is just a quick example.
 

Users who are viewing this thread

Back
Top Bottom