John-
I got it. Thanks a lot.
Best Regards,
Kevin
Date: 2016-01-16 18:08Subject: Re: [MS_AccessPros] Is that possible to apply a filter to a subform from main form?Kevin-
You would need to see if a filter is already applied, grab it, add the additional criteria with AND, then apply that. If you might apply multiple criteria, it's best to enclose the filter in parens. For example, instead of doing:Field1 = 2do:(Field1 = 2)Then to add another criteria, do:If Len(Me.Filter) > 0 ThenMe.Filter = Me.Filter & " AND " & "(Field2 = 'A')"ElseMe.Filter = "(Field2 = 'A')"End IfJohn Viescas, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL Queries for Mere Mortals(Paris, France)
On Jan 16, 2016, at 9:45 AM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:John-After runing one filter, if a new filter is ran, is possible to filter based on the first filter, instead of on the all records? Thanks.Best Regards,Kevin
Date: 2016-01-15 04:42Subject: Re: [MS_AccessPros] Is that possible to apply a filter to a subform from main form?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, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL 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 SubBest Regards,Kevin
__._,_.___
Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar