Results 1 to 7 of 7
  1. #1
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39

    Question how to filter on data that begins with "PI"

    In design view, how do I filter on my data so that it only shows data that beings with "PI"? Yes I know I can do this by the main screen and say select text that beings with PI but I would like to know how to do it with sql.

    thank you

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you do it in the query.
    use an asterisk in the field criteria type: PI*
    it will change to LIKE 'pi*'

    you can do live filters on the form using the full query
    select * from table
    then filter using a text box txtBox1, and the afterUpdate event

    Code:
    sub txtBox1_Afterupdate()
    me.filter = "like '" & txtBox1 & "*'"
    me.filterOn = true
    end sub

  3. #3
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    i think i figured it out....

    like "PI%"

  4. #4
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    thank you ranman, I think we posted at the same time.

  5. #5
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    % only filters 1 character.
    * filters EVERYTHING after the PI.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Actually % does match any number of characters. https://support.office.com/en-ie/art...9-e18abaad12d1
    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.

  7. #7
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    Quote Originally Posted by June7 View Post
    Actually % does match any number of characters. https://support.office.com/en-ie/art...9-e18abaad12d1
    awesome link! very very helpful

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

Similar Threads

  1. Replies: 4
    Last Post: 01-22-2015, 10:30 AM
  2. Replies: 11
    Last Post: 06-18-2013, 07:48 AM
  3. Replies: 3
    Last Post: 11-27-2012, 07:20 AM
  4. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  5. Form Filter "Missing Data" Using VBA
    By r0v3rT3N in forum Programming
    Replies: 12
    Last Post: 07-20-2012, 12:40 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