Conditional Visible Subform

cruzpatas

Registered User.
Local time
Today, 10:12
Joined
Dec 16, 2005
Messages
41
I have subform that I only want to be visible in a parent form when the combo box has "Screening " selected. Here is my code. I'm not sure why this is wrong.

Private Sub cboEvent_Change()
If Me.cboEvent = "Screening" Then
Forms!Initial_Action_Donor_Center.Form.sfrmScreeningDetail.Visible = True
Else
Forms!Initial_Action_Donor_Center.Form.sfrmScreeningDetail.Visible = False
End If

End Sub


Initial_Action_Donor_Center is my parent form
sfrmScreeningDetail is my sub
Please Help!!!
 
I fixed it. my sub was misnamed in the form.

Private Sub cboEvent_Change()
If Me.cboEvent = "Screening" Then
Me!sfrmScreeningDetail.Visible = True
Else
Me!sfrmScreeningDetail.Visible = False
End If
End Sub
 
Alright, I have it working sort of. The sub is vislibe only when I change the cmbo box to "screening" but when I go to another form that already has the cmbo box with screening< the sub is still invisible. I have tried Current() Before Update() and all of them but it is still only visible when I make change. What do I have to do to make it visible as soon as I open the form and the combo has "Screening" in it. Here is my code:

Private Sub cboEvent_Change()
If Me.cboEvent = "Screening" Then
Me!sfrmScreeningDetail.Visible = True
Else
Me!sfrmScreeningDetail.Visible = False
End If
End Sub
 
This code in the Form_Current event as well as the cbo's OnChange event should do the trick, but the cboEvent control has to be bound to a field in the underlying table.
 

Users who are viewing this thread

Back
Top Bottom