L
Lau via AccessMonster.com
I have a database designed to maintain family membership information. I have
a mainform and subform. The subform draws data from tbl_family, which
contains fields - household_id, family_member_id, and relationship plus
others. Please note that Head of Household (coded AA) is one of the
selections for Relationship field.
On subform, each time the user selects a different person to be the Head of
Household, the relationships for all family members reset to blank, except
the one person just selected for head of household. Here is my working codes:
************
Private Sub cboRelationship_Change()
Dim strSQL_updhead As String
If Me.relationship_id = "AA" Then
If (MsgBox("Selecting new 'Head of Household' will reset relationship for
all family members. Are you sure you want to do this?", vbOKCancel) =
vbCancel) Then
Me.Undo
Else
strSQL_updhead = "UPDATE tbl_family " & _
"SET relationship_id = NULL " & _
"WHERE (household_id = " & me.household_id & ") and
(family_member_id <> " & Me.family_member_id & " );"
DoCmd.RunSQL strSQL_updhead
End If
End If
End Sub
************
I do not want household_id and family_member_id to appear on the subform.
Setting field properties Enabled =No and Visible=No won't help. How do I
access the 2 fields without putting them on the subform? Can somebody shade
some lights? Thanks.
a mainform and subform. The subform draws data from tbl_family, which
contains fields - household_id, family_member_id, and relationship plus
others. Please note that Head of Household (coded AA) is one of the
selections for Relationship field.
On subform, each time the user selects a different person to be the Head of
Household, the relationships for all family members reset to blank, except
the one person just selected for head of household. Here is my working codes:
************
Private Sub cboRelationship_Change()
Dim strSQL_updhead As String
If Me.relationship_id = "AA" Then
If (MsgBox("Selecting new 'Head of Household' will reset relationship for
all family members. Are you sure you want to do this?", vbOKCancel) =
vbCancel) Then
Me.Undo
Else
strSQL_updhead = "UPDATE tbl_family " & _
"SET relationship_id = NULL " & _
"WHERE (household_id = " & me.household_id & ") and
(family_member_id <> " & Me.family_member_id & " );"
DoCmd.RunSQL strSQL_updhead
End If
End If
End Sub
************
I do not want household_id and family_member_id to appear on the subform.
Setting field properties Enabled =No and Visible=No won't help. How do I
access the 2 fields without putting them on the subform? Can somebody shade
some lights? Thanks.