A subform appears when a chekbox is cheked¡

F

filo666

Hello, I want 2 things:
1) put 2 chek box's, when one is activate the other one is desactivate,, the
tow of them can't be activated at the same time, How?
2) when a chek box is cheked, a subform appears, when is uncheked the
subform disapeer, but as I have 2 chek box's, I also have 2 subforms, I put
the code attached below, but this code just works for one chekbox and sub
form, when I add the second one It's not working, it appears a message box
with: "The expresion after updater you entered as the event property setting
produced the following error: Ambiguous name detected: Form_Current.
I thing this appears because something about the "me" but I dont know, any
suggestions????

tks

Private Sub Check20_AfterUpdate()
Me!Salidassubform.Visible = Me!Check20
End Sub

Private Sub Form_Current()
Me!Salidassubform.Visible = Me!Check20
End Sub


Private Sub Check10_AfterUpdate()
Me!Notasubform.Visible = Me!Check10
End Sub

Private Sub Form_Current()
Me!Notasubform.Visible = Me!Check10
End Sub
 
K

Kevin K. Sullivan

2.
It looks like you created a second Form_Current event in code. There
can only be one. Delete the second Form_Current and put two lines in
the first:
---
Private Sub Form_Current()
Me!Salidassubform.Visible = Me!Check20
Me!Notasubform.Visible = Me!Check10
End Sub
---

1. To make controls mutually exclusive, don't use checkboxes, use radio
buttons. Draw an option group frame on the form. Drop two radio
buttons inside the frame. Each radio button has an option value - the
value its frame receives when it is clicked. If you use the defaults of
one and two, you could change you code to something like

---
Private Sub Form_Current()
Me!Salidassubform.Visible = Me!Frame1 = 1
Me!Notasubform.Visible = Me!Frame1 = 2
End Sub
---

Besure to recode the click events of the radio buttons. Also, set the
visibility of the subforms to match the default value of the option group.

HTH,
 
Top