Results 1 to 4 of 4
  1. #1
    ketangarg86 is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2014
    Posts
    24

    Access Apply Filter action

    Hi,

    I am using ApplyFilter embedded macro to filter the results in the table. The values comes from multiple fields in a form. If I apply multiple filters, the do not show the combined effect. Only one of the Apply Filter macro's takes effect.



    I am unable to put all the search criteria in one ApplyFilter where condition string because of 255 character limit.

    Could you please advise what can I do.

    Thanks a lot for your help.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Have you tried :

    Test all controls for a possible filter, if not used, skip it...

    Code:
    If not isnull(cboState) then  sWhere = sWhere & " and [state] like '*" & cboState & "*'"
    If not IsNull(txtName) then   sWhere = sWhere & " and [Name] like '*" & txtName & "*'"
    If not IsNull(txtContact) then  sWhere = sWhere & " and [Contact]  like '*" & txtContact.value & "*'"
    
    'remove 1st And
    sWhere= mid(sWhere,4)
    
    sSql = "SELECT * FROM tblCompany WHERE "
    sSql = sSql & sWhere
      'apply the sql to the form
    
       'OR   
    'just use the filter
    
    me.filter = sWhere
    me.filterOn = true

  3. #3
    ketangarg86 is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2014
    Posts
    24
    Thanks dude. BUt I am using embedded macros. I dont know how to use VBA that much. I have a macro to open a data table also. Is there a way I can join multiple ApplyFilter macros in the embedded view.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Are these all text fields? Only alternative I know is dynamic parameterized query. Review http://www.datapigtechnologies.com/f...earchform.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 2
    Last Post: 02-25-2013, 10:47 AM
  3. Replies: 5
    Last Post: 02-07-2013, 12:21 PM
  4. Apply Filter similar to Field Filter
    By DatabaseIntern in forum Forms
    Replies: 1
    Last Post: 06-11-2012, 05:42 PM
  5. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums