Results 1 to 4 of 4
  1. #1
    AccessUser123 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    5

    Excluding records that contain wildcards

    I have a table where some of the records contain the wildcard character *. I need to generate a query that will select all records in the table except for those that contain *. I've tried entering the following query criteria:

    <>"*"



    But this returns all records in the table. Any ideas how to do this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    If the only character is the * then: <>"[*]"
    If there are other characters then: Not Like "*[*]*"
    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
    AccessUser123 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    5
    Thanks, that worked. I actually have three data types I need to exclude:

    Records that contain *
    Records that contain ?
    Records that contain a specific text string (#TextString1)

    Using the criteria posted above, I can exclude all three of these types of records individually, but when I try to exclude all of them at the same time it doesn't work. Here's the criteria I've been trying to use:

    Not Like "*[*]*" Or Not Like "*[?]*" Or Not Like "#TextString1"

    I've tried a bunch of different variations on this but nothing seems to work. The query just returns all records in the table.

  4. #4
    AccessUser123 is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    5
    I think I figured it out. I changed the "or" to "and" in the query criteria and now all three "not like" statements are working correctly. Thanks for your help!

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

Similar Threads

  1. VBA Wildcards
    By dssrun in forum Programming
    Replies: 11
    Last Post: 03-31-2011, 08:44 AM
  2. SQL Wildcards
    By sandlucky in forum Queries
    Replies: 4
    Last Post: 03-28-2011, 03:31 AM
  3. Using wildcards with between workaround
    By rushforth in forum Queries
    Replies: 2
    Last Post: 11-10-2010, 02:12 PM
  4. Using wildcards (*) in SQL
    By SIGMA248 in forum Queries
    Replies: 1
    Last Post: 07-22-2010, 08:44 PM
  5. Wildcards?!
    By esx_raptor in forum Access
    Replies: 3
    Last Post: 02-19-2010, 03:22 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