Results 1 to 2 of 2
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    How do I specify ControlName for SetFilter


    Been trying for hours to get this right:

    Code:
    DoCmd.SetFilter (WhereCondition:="[Complaint] LIKE '*" & [txtFilter] & "*'", ControlName:="BercComplaintsSF")
    I get Compile Error "Expected: ="

    The problem is with the ControlName part, without that works ok. - Googled it couldn't find any examples of ControlName being used.

    Decided to try a different route, but would very much like to know what the correct syntax is.

    Thanks
    David

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,929
    I don't use docmd.setfilter but including brackets means it is trying to return something. The example provided here, does not use brackets, so why are you?

    https://msdn.microsoft.com/en-us/vba...or=-2147217396

    otherwise just use

    me.BercComplaintsSF.form.filter="[Complaint] LIKE '*" & [txtFilter] & "*'"
    me.BercComplaintsSF.form.filteron=true

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

Similar Threads

  1. Setfilter,Like
    By civl_eng in forum Programming
    Replies: 2
    Last Post: 09-07-2017, 03:03 AM
  2. Replies: 10
    Last Post: 04-07-2014, 12:49 PM
  3. Setfilter works in Access but not Sharepoint
    By estroud in forum SharePoint
    Replies: 1
    Last Post: 05-28-2012, 12:55 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