Results 1 to 3 of 3
  1. #1
    civl_eng is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    41

    Setfilter,Like

    hi all,

    i use Below code to Filter record and it is working right :



    DoCmd.SetFilter WhereCondition:="[Phone1] = [Forms]![frm_Project]![Text187]"

    now i want to use like in DoCmd.SetFilter, but its not Working :

    DoCmd.SetFilter WhereCondition:="[Phone1] Like " * " & [Forms]![frm_Project]![Text187] & " * ""

    I am waiting for your reply. thanks in advanced.
    (sorry, my english isn't good)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,951
    Try using apostrophe delimiters and remove spaces on each side of * and remove a pair of quote marks:

    DoCmd.SetFilter WhereCondition:="[Phone1] Like '*" & [Forms]![frm_Project]![Text187] & "*'"

    I've never use this command. Where is this code? What are you filtering?
    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.

  3. #3
    civl_eng is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    41
    thank you, It worked right.
    yes by that vba code i filter Phone number in split form, i realized that there was no difference between :

    DoCmd.ApplyFilter WhereCondition:="[Phone1] Like '*" & [Forms]![frm_Project]![Text187] & "*'"

    and

    DoCmd.SetFilter WhereCondition:="[Phone1] Like '*" & [Forms]![frm_Project]![Text187] & "*'"

    thanks again.

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

Similar Threads

  1. Replies: 10
    Last Post: 04-07-2014, 12:49 PM
  2. 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