Results 1 to 8 of 8
  1. #1
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39

    Question how to trim a numeric value?

    I have tons of values for example...



    043401792930179293000000000000
    486934620469284720452458733452
    548065110164648465132013541355

    I only want to keep the values in red. 2nd, 3rd and forth columns of each value. Is there some sort of Trim I can do?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Are your entries actually a Number or Text Data Type?
    I ask because your first entry has a leading zero. The only way a leading zero will be displayed is if:
    - the entry is actually Text and not numeric
    - it a number with some Custom Formatting

    Whether it is Text or Numeric will determine how we need to approach your question.
    If it is Text, we can just use the MID function, i.e.:
    MID([MyField],2,3)

  3. #3
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    they are numeric values.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You should be able to use the FORMAT function along with the same Custom Formatting you have applied to this field to coerce that numeric entry to a text entry, and then you can use the Text formula I provided previously on it.

  5. #5
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    how would I use the format function? Do you mean like a from up on top of FORMAT as code value?

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What is the Custom Format you are using on that number to get the leading zero to show?

  7. #7
    eeps24 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    39
    I am not sure, all i did was run a pretty much basic query and that result came in just like that. I didnt do anything else to it.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Numbers don't have leading zeros. What is the field type the value is stored in? That many digits, Access will insist on scientific notation when it displays the value in a number type field.

    If the field is text type, try the expression suggested by JoeM.
    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.

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

Similar Threads

  1. Trim!
    By redbull in forum Programming
    Replies: 9
    Last Post: 11-06-2012, 06:01 AM
  2. Trim vba
    By shexe in forum Access
    Replies: 5
    Last Post: 11-16-2011, 10:20 AM
  3. Trim value
    By dada in forum Programming
    Replies: 5
    Last Post: 09-02-2010, 11:01 PM
  4. Need Help with TRIM command
    By rbfarley in forum Reports
    Replies: 3
    Last Post: 01-08-2010, 02:03 PM
  5. Trim
    By JMantei in forum Forms
    Replies: 1
    Last Post: 06-20-2006, 02:06 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