A
Al Williams
Access 2003: I’m doing a database for a Learning Center. I have a
Household information form on one tab control and a Household Members
subform. The subform Default View is continuous and I have the current
record and a portion of the next record (Household Member) showing on
the subform.
I’d like to change the visibility of controls on the subform depending
upon combo box choices made by the user. But making a choice on one
record changes the controls on the subform showing the next record also.
Is there a way to keep control visibility changes on a form limited to
just the current record? I believe that I could change the subform
Default View to single and thereby mask the fact that the controls are
changing but I’d rather not. The event procedure I used follows:
Thanks.
Al Williams
Private Sub MemberRoleID_AfterUpdate()
' Make visible only those controls which are applicable to the
Household Member's role
'
Dim strRoleC As String
Dim strRoleD As String
Dim strRoleN As String
Dim strRoleP As String
'
strRoleC = "Caregiver"
strRoleD = "Dependent"
strRoleN = "N/A"
strRoleP = "Parent"
'
'If Caregiver selected
If Me!MemberRoleID = strRoleC Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If Dependent selected
If Me!MemberRoleID = strRoleD Then
Me!lblStudentRole.Visible = True
Me!StudentRoleID.Visible = True
Me!lblStudentGrade.Visible = True
Me!StudentGradeID.Visible = True
Me!lblChildsBirthOrder.Visible = True
Me!ChildsBirthOrder.Visible = True
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If N/A selected
If Me!MemberRoleID = strRoleN Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If Parent selected
If Me!MemberRoleID = strRoleP Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = True
Me!ParentStatusID.Visible = True
End If
End Sub
Household information form on one tab control and a Household Members
subform. The subform Default View is continuous and I have the current
record and a portion of the next record (Household Member) showing on
the subform.
I’d like to change the visibility of controls on the subform depending
upon combo box choices made by the user. But making a choice on one
record changes the controls on the subform showing the next record also.
Is there a way to keep control visibility changes on a form limited to
just the current record? I believe that I could change the subform
Default View to single and thereby mask the fact that the controls are
changing but I’d rather not. The event procedure I used follows:
Thanks.
Al Williams
Private Sub MemberRoleID_AfterUpdate()
' Make visible only those controls which are applicable to the
Household Member's role
'
Dim strRoleC As String
Dim strRoleD As String
Dim strRoleN As String
Dim strRoleP As String
'
strRoleC = "Caregiver"
strRoleD = "Dependent"
strRoleN = "N/A"
strRoleP = "Parent"
'
'If Caregiver selected
If Me!MemberRoleID = strRoleC Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If Dependent selected
If Me!MemberRoleID = strRoleD Then
Me!lblStudentRole.Visible = True
Me!StudentRoleID.Visible = True
Me!lblStudentGrade.Visible = True
Me!StudentGradeID.Visible = True
Me!lblChildsBirthOrder.Visible = True
Me!ChildsBirthOrder.Visible = True
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If N/A selected
If Me!MemberRoleID = strRoleN Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = False
Me!ParentStatusID.Visible = False
End If
'If Parent selected
If Me!MemberRoleID = strRoleP Then
Me!lblStudentRole.Visible = False
Me!StudentRoleID.Visible = False
Me!lblStudentGrade.Visible = False
Me!StudentGradeID.Visible = False
Me!lblChildsBirthOrder.Visible = False
Me!ChildsBirthOrder.Visible = False
Me!lblParentStatus.Visible = True
Me!ParentStatusID.Visible = True
End If
End Sub