Results 1 to 3 of 3
  1. #1
    vad77 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2013
    Location
    USA
    Posts
    101

    Question Query using Like criteria pattern matching

    I have a query built that will produce results on user input for two fields, System and StationName.
    In the criteria I have the following.

    Like "*" & [Enter CIC System] & "*"
    Like "*" & [Enter Station Criteria:] & "*"

    I have 3 systems with two having similar names



    SysA
    SysB
    Non-SysB

    If I enter SysB in the for system criteria my results will include Non-SysB.
    What do I need as the criteria that when SysB is entered is does not in clude Non-SysB in the results.

    Hope I am clear In what I am asking.
    Thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    AND NOT [fieldname] LIKE "Non*"

    Or maybe don't use the first * wildcard. Does user type "A" or "B" or "SysB"?

    I never use dynamic parameterized query - cannot validate user input. I prefer VBA to build filter criteria and apply to form or report. Review http://allenbrowne.com/ser-62.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.

  3. #3
    vad77 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2013
    Location
    USA
    Posts
    101
    Thanks for you reply, again over thought things. Turned something simple to complicated. Just removed the wild cards from system. Need to get back to the office staying home is taking a toll. Thanks for the help.

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

Similar Threads

  1. Replies: 6
    Last Post: 07-01-2015, 09:56 AM
  2. Help with Pattern matching in access query
    By javajockey in forum Queries
    Replies: 3
    Last Post: 10-01-2014, 08:38 PM
  3. Replies: 4
    Last Post: 06-30-2014, 02:53 PM
  4. Selecting records with matching criteria
    By Daryl2106 in forum Access
    Replies: 2
    Last Post: 09-07-2013, 03:57 AM
  5. Pattern Matching In Access 2010
    By Mike Henderson in forum Access
    Replies: 1
    Last Post: 02-21-2013, 12:27 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