I
Irshad Alam
I have a Form Named FORM1, based on no tables or queries.
Only it has a Option Group Frame in that it include 2
option button. Other than that there is a Text box "Text2"
and a Command Button on the Form1.
Later In the FORM1 I have Inserted FORM2 as a Subform.
This FORM2 is based on a Table named TELEDIR.
Now my need is that what ever is typed on the text
control "Text2" of FORM1 and if the Frame value is 1, then
the subform will filter the data for the Company name
field only. Next if the Frame value is 2, then it will
filter the ContPerson Name based on the Text control of
the FORM1 only.
The Code I put on the command button is as below, which
does not work :
If Me.Frame0=1 Then
Me.Form2.SetFocus
DoCmd.ApplyFilter "", "[CoName] Like ""*"" & [Forms]!
[Form1]![Text2] & ""*"""
else
If Me.Frame0=2 Then
Me.Form2.SetFocus
DoCmd.ApplyFilter "", "[ContactPer] Like ""*"" & [Forms]!
[Form1]![Text2] & ""*"""
End If
End If
'*********
But the above code does not work. Please advise me, what
code should I use to filter the subform records, based on
the option and the form text control.
Please advise.
Only it has a Option Group Frame in that it include 2
option button. Other than that there is a Text box "Text2"
and a Command Button on the Form1.
Later In the FORM1 I have Inserted FORM2 as a Subform.
This FORM2 is based on a Table named TELEDIR.
Now my need is that what ever is typed on the text
control "Text2" of FORM1 and if the Frame value is 1, then
the subform will filter the data for the Company name
field only. Next if the Frame value is 2, then it will
filter the ContPerson Name based on the Text control of
the FORM1 only.
The Code I put on the command button is as below, which
does not work :
If Me.Frame0=1 Then
Me.Form2.SetFocus
DoCmd.ApplyFilter "", "[CoName] Like ""*"" & [Forms]!
[Form1]![Text2] & ""*"""
else
If Me.Frame0=2 Then
Me.Form2.SetFocus
DoCmd.ApplyFilter "", "[ContactPer] Like ""*"" & [Forms]!
[Form1]![Text2] & ""*"""
End If
End If
'*********
But the above code does not work. Please advise me, what
code should I use to filter the subform records, based on
the option and the form text control.
Please advise.