Kevin-
Yes. You need to get to the form inside the subform control like this:
Me.SubformControl.Form.Filter = …
.. where "SubformControl" is the name of the control that contains the subform.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Jan 14, 2016, at 9:34 PM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Dear All,
I learned how to use filter in a form. Is that possible to apply a filter to a subform from main form? Thanks.
Private Sub SearchName_AfterUpdate()
On Error GoTo ErrHandle
DoCmd.ShowAllRecords
Me.Filter = "SearchAll Like ""*" & Me.SearchName & "*"""
Me.FilterOn = True
Me.SearchName.SetFocus
ErrExit:
Exit Sub
ErrHandle:
Resume ErrExit
End Sub
On Error GoTo ErrHandle
DoCmd.ShowAllRecords
Me.Filter = "SearchAll Like ""*" & Me.SearchName & "*"""
Me.FilterOn = True
Me.SearchName.SetFocus
ErrExit:
Exit Sub
ErrHandle:
Resume ErrExit
End Sub
Best Regards,
Kevin
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar