I have a frame with two option buttons inside, and what i want is when a option button are true(checked) i do one thing and when de other button are true(checked) i do it another.
The option group(frame) itself has a value. When the first button is checked the value is one, the second and the value is two and so on. So all you need is a Select statement:
Select Case YourOptionGroup.Value
Case 1
**Code for if the first button is checked
Etc.
End Select
Maybe you can post the code you are using, that might help to see what the problem is. One quick question, did you make the frame first or the buttons first?
Well, this is what I thought was happening. When you put a check box or a radio button in a frame(Option group), then the check box will not have a value of its own and you cannot test for it. The buttons will have an optionvalue which you can select for yourself but Access will automatically set them at 1 for the first one you place, 2 for the second and so forth. The frame will have as its value the optionvalue of the selected button. So, in your code, you need to leave out the If statement and you should get the results your are looking for.
You don't check the value of the checkboxes in the frame, you check the value of the frame itself. Each checkbox in the frame corresponds to a number (the Option Value property). When you check a box, the frame itself when reviewed will be equal to the option value of the checked box.
So let's say your frame is named "frm_Alterar" and you have a checkbox in it named "Chk_QuerPreSeleccao" with an option value of 1, here's the code.
[tt]
Select Case Frm_Alterar
Case Is = 1
MsgBox "Chk_QuerPreSeleccao is checked!"
Case Else
MsgBox "Option Value " & Frm_Alterar & " is checked!"
End Select
[/tt]
HTH Joe Miller
joe.miller@flotech.net
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.