P
PaulB
Hi All,
For my daughter's primary school, I'm writing some kind of admin
application. While doing this, I have the next question.
I have two tables:
- TblParents, which has (amongst others) fields [ID_Parents] and
[FamilyName]
- TblChilds, which has (amongst others) fields [ID_Parents], [FirstName]
and [FamilyName]
There's a relation: both have field [ID_Parents]
In the main form (FrmParents), there is a subform (subFrmChilds), linked
with [ID_Parents]. This works fine.
In this form, there is a text box [StrFilter], which is the input for a
filter. What I want is that this filter has effect on both the
Familyname and the FirstName. The background of this idea is that the
user should be able to filter as easy as possible. So, regardless
whether he's looking for a firstname or a familiy name, he's using one
text box.
I tried to do this as follows (event code in FrmParents):
If Me.StrFilter <> "" Then
Me.Filter = "[FamilyName] like '*" & Me.StrFilter & "*'"
Me.FilterOn = True
With Me.subFormChilds.Form
.Filter = "[FirstName] like '*" & Me.StrFilter& "*'"
.FilterOn = True
End With
Else
Me.FilterOn = False
Me.subFrmChilds.Form.FilterOn = False
End If
Endif
Anyhow, this filter only works fine for filtering the mainform. There's
no effect on the subform.
What should I change to make it work for the subform as well?
Thanks in advance for any suggestions.
Paul
For my daughter's primary school, I'm writing some kind of admin
application. While doing this, I have the next question.
I have two tables:
- TblParents, which has (amongst others) fields [ID_Parents] and
[FamilyName]
- TblChilds, which has (amongst others) fields [ID_Parents], [FirstName]
and [FamilyName]
There's a relation: both have field [ID_Parents]
In the main form (FrmParents), there is a subform (subFrmChilds), linked
with [ID_Parents]. This works fine.
In this form, there is a text box [StrFilter], which is the input for a
filter. What I want is that this filter has effect on both the
Familyname and the FirstName. The background of this idea is that the
user should be able to filter as easy as possible. So, regardless
whether he's looking for a firstname or a familiy name, he's using one
text box.
I tried to do this as follows (event code in FrmParents):
If Me.StrFilter <> "" Then
Me.Filter = "[FamilyName] like '*" & Me.StrFilter & "*'"
Me.FilterOn = True
With Me.subFormChilds.Form
.Filter = "[FirstName] like '*" & Me.StrFilter& "*'"
.FilterOn = True
End With
Else
Me.FilterOn = False
Me.subFrmChilds.Form.FilterOn = False
End If
Endif
Anyhow, this filter only works fine for filtering the mainform. There's
no effect on the subform.
What should I change to make it work for the subform as well?
Thanks in advance for any suggestions.
Paul