Results 1 to 4 of 4
  1. #1
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29

    Is there a way to query or search for the last four digits in SSN field

    I have a search query with a field for the SSN. As I have it now, it works-in that someone can type in anywhere from one to nine numbers in the search form and the query will return the result, any SSN's that have those numbers in that particular sequence.
    Example: you type in 1234 and you would get say SSN such as 123-45-6789, 912-34-5678, 555-12-3456, and so on.

    What I would like is to be able to search for just the last four digits. Is this possible?



    My current criteria in my SSN field in the query is:
    Like "*" & [Forms]![frmSearch]![txtSSNumber] & "*"

    Additionally, not sure if this will affect it, but I have the SSN field in my main table as an input mask: 000\-00\-0000;;_

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Just drop the second wildcard:

    Like "*" & [Forms]![frmSearch]![txtSSNumber]

    You could also use the Right() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Vetgeorge is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Florida
    Posts
    29
    Thank you, it works! I said to myself "you eediot" when I saw how simple the solution was.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Combo Box = Query Field Name to search
    By jlclark4 in forum Programming
    Replies: 1
    Last Post: 02-27-2013, 11:38 AM
  2. Multi-Field Search issues within Query
    By stiracerdude in forum Queries
    Replies: 3
    Last Post: 10-14-2012, 01:04 PM
  3. Allow only 4 digits in field
    By funkygoorilla in forum Forms
    Replies: 2
    Last Post: 12-01-2011, 09:21 AM
  4. Replies: 2
    Last Post: 07-12-2011, 07:53 PM
  5. Report query by digits
    By The Phil in forum Reports
    Replies: 4
    Last Post: 04-23-2010, 11:52 AM

Tags for this Thread

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