Results 1 to 3 of 3
  1. #1
    Robeen is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596

    Working with 16-digit Text numbers.

    I have a Text field named 'Code' that has 2, 3, 4 & 16 digit 'numbers'.


    These are codes - so I will never do math with them.

    BUT . . . I want to be able to return a range of codes [say 1000 - 1999, inclusive] in a query. Only with 4-digit code ranges . . .

    How do I get the query to correctly do the equivalent of this:
    IIf ((Code > "999" and Code < "2000"), DisplaySomething, DisplaySomethingElse)

    OR

    [How] can I successfully convert the field to a numeric field that will handle 16-digit numbers and then let me do the numeric query?

    Thanks!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Access is not going to play nice with 16 digits so converting to number with functions like Val() will likely fail.

    Need placeholder zeros, like: 0000000000000999, 0000000000002000, 0567254526352564. Use Format() function.

    IIf(Format([Code], "0000000000000000") > "0000000000000999" AND Format([Code], "0000000000000000") < "0000000000002000"), this, else this)

    Review https://support.microsoft.com/en-us/kb/210573
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Hey, Robeen.... long time....

    Totally untested... maybe:
    EDIT: Just tested. Seems to work correctly

    Convert all "numbers" to 16 characters and test.

    SomeName: IIf ((Right("000000000000000" & code,16) > "0000000000000999" and Right("000000000000000" & code,16)< "0000000000002000"), DisplaySomething, DisplaySomethingElse)

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

Similar Threads

  1. 2-digit numbers turning to "##"
    By bradp1979 in forum Reports
    Replies: 3
    Last Post: 10-10-2015, 08:32 AM
  2. UPDATE QUERY to Separate Numbers from Text in a Text Field
    By pjordan@drcog.org in forum Queries
    Replies: 2
    Last Post: 05-29-2015, 02:44 PM
  3. Replies: 1
    Last Post: 03-27-2014, 06:39 AM
  4. Sort numbers based on second digit
    By Dale S in forum Queries
    Replies: 1
    Last Post: 05-16-2012, 07:06 AM
  5. Entering 16 digit numbers into number field
    By chrismid259 in forum Access
    Replies: 7
    Last Post: 12-14-2010, 10:40 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