Results 1 to 3 of 3
  1. #1
    BullwinkleTMoose is offline Novice
    Windows 8 Access 2013 32bit
    Join Date
    Oct 2015
    Posts
    6

    Question Querying for values that end in #

    I am trying to write a query against a table that contains product codes. Most of them are numeric (00001), but some end in an alpha (00001_A) or a character (00000_#)



    When I try to query for the codes that end in #, I am having a problem.

    If I use a wild card in my query (*# or Like "*#"), I am getting all of the values that end with a number but not the ones that ends with #.

    Is there a trick to writing my query to just return the values that end in #?

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Right([Field1],1)=Chr(35)

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I was able to use this query
    Code:
    SELECT tblYourTableName.ProductCode
    FROM tblYourTableName
    WHERE (((InStr([ProductCode],"#"))>0));
    but thought there must be a better way.

    Since the hash mark is a delimiter in Access, I found adding brackets tells Access to search for the hash as a text character. (This will work for any special character)
    Code:
    SELECT tblYourTableName.ProductCode
    FROM tblYourTableName
    WHERE tblYourTableName.ProductCode Like "*[#]";
    Change "tblYourTableName" to the name of your table.......

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

Similar Threads

  1. Replies: 3
    Last Post: 08-09-2015, 06:57 PM
  2. Help regarding MS Access querying
    By gar6920 in forum Access
    Replies: 2
    Last Post: 12-09-2014, 05:28 PM
  3. Replies: 7
    Last Post: 11-24-2014, 01:32 PM
  4. Querying Oracle
    By ErinK in forum Programming
    Replies: 5
    Last Post: 06-11-2014, 01:10 PM
  5. Help Querying series
    By ktmchugh in forum Queries
    Replies: 20
    Last Post: 05-05-2009, 04:31 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