Results 1 to 6 of 6
  1. #1
    skydivetom is offline Expert
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    779

    Need query to identify 10-digit numeric values

    Experts:



    I need assistance with developing a query to identify records that do NOT include a 10-digit number.

    Background:

    - I have a data set with nearly 70,000 records.
    - One field is called "DOD_ID"... any valid record includes a 10-digt number (e.g., 1234567890).
    - However, there are a few records that look as follows:

    1. Alpha-numeric values:
    - Example #1: "62C4839456"
    - Example #2: "123456789X"

    ... both records include a non-numeric value somewhere in the string.

    2. Numeric values less than 10 characters:
    - Example #1: "123456789"
    - Example #2: "12345678"

    ... both records are less than 10 characters in length and thus are "invalid".

    My question:
    What SQL query would allow me to identify any records which either 1) are alpha-numeric or b) are < 10 characters in length? Ideally, I'd like to use a single query (vs. 2 queries).

    Thank you,
    Tom

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,813
    Try

    WHERE IsNumeric(DOD_ID) = False OR Len(DOD_ID) < 10
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    15,613

  4. #4
    Ajax is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    9,132
    How are you getting this data? If from a linked excel table it is likely you will get #error for the non numeric values. Your field type needs to be designated as text

  5. #5
    skydivetom is offline Expert
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    779
    Sorry for the delayed response... I got side-tracked.

    pbaldy -- your solution works great. Thank you!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,813
    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. Replies: 3
    Last Post: 03-18-2020, 04:54 PM
  2. Replies: 9
    Last Post: 01-16-2019, 02:13 PM
  3. Ordering Numeric Values
    By kazaccess in forum Access
    Replies: 7
    Last Post: 12-31-2013, 02:00 PM
  4. Replies: 2
    Last Post: 12-11-2012, 12:04 PM
  5. Updating Numeric Values
    By dssrun in forum Queries
    Replies: 9
    Last Post: 11-24-2010, 11:20 AM

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 - Senior Forums