Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Query Filter

  1. #1
    New Member
    Join Date
    Jun 2018
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Query Filter

    I have a field in my dBase that contains the Active Directory Distinguished Name, that I need to filter on to separate account types. The data string in the field will look like this for a user account:

    CN=Lapp\, Lawrence E. (Larry) (TUC) ISSO,OU=Users,OU=Tucson (TUC),OU=VISN18,DC=v18,DC=med,DC=va,DC=gov

    And this for a service account:

    CN=Admin\, Dental,OU=Service Accounts,OU=Tucson (TUC),OU=VISN18,DC=v18,DC=med,DC=va,DC=gov

    I need to filter on either the word User or Service (bolded) so I can pull the different account type to their respective tabs. I have tried a like filter with a wild card parameter and that didn't work.

    Any assistance would be great.

  2. #2
    MrExcel MVP
    Join Date
    May 2006
    Location
    Excel 2003, Australia
    Posts
    8,949
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Query Filter

    I don't use Access really. So not sure if the wild card character is % or *

    How about,

    WHERE fieldname LIKE '%,OU=Users,%' OR fieldname LIKE '%,OU=Service Accounts,%'

    and obviously if *
    WHERE fieldname LIKE '*,OU=Users,*' OR fieldname LIKE '*,OU=Service Accounts,*'
    If you've posted a clearly explained question & sample data - both input & corresponding output - that can be copied to Excel, THANK YOU.

  3. #3
    New Member
    Join Date
    Jun 2018
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Query Filter

    Good morning, thank you for the suggestion. After trying both strings you provided, unfortunately neither of them worked.

  4. #4
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,220
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Query Filter

    How exactly did you implement the use of this search criteria? (i.e., if in SQL, then what is the actual SQL that you used?)

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  5. #5
    New Member
    Join Date
    Jun 2018
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Query Filter

    Score! I was able to get it working..

    If I add the criteria filter in design view vice SQL view, the string would look like

    Like "*Users*"

    where the * is wildcards before and after the key word

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •