Results 1 to 2 of 2

Add "X" to a string to make it 8 characters in length

  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Add "X" to a string to make it 8 characters in length

    add "X" to a string to make it 8 characters in length.



    I have a numeric string that can be between 2-8 characters long, this is a numeric string, not an integer or long. If the characters are less than 8, I want to add "X" to the end of it until the len = 8.

    For some reason, I am having a hard time coming up with a clean way of doing this. Is this something I can do just with a format statement?

    EDIT*
    I'm an idiot.... I just added "XXXXXXXX" to the string, then do a left 8... that works... God I need more coffee.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    46,889
    You want to add the letter "X" - padding on the right?

    That's different. Usually the requirement is to add leading zeros which can be done with Format() function: Format(123, "00000000")
    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. Using "Make Table" query versus "Select" query
    By Bcanfield83 in forum Database Design
    Replies: 3
    Last Post: 01-04-2019, 04:11 PM
  2. Replies: 1
    Last Post: 09-07-2015, 07:00 AM
  3. Replies: 4
    Last Post: 02-06-2015, 02:58 AM
  4. Replies: 7
    Last Post: 07-19-2013, 10:58 AM
  5. Replies: 1
    Last Post: 10-08-2012, 08:01 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
  •  
Tech Forums: Microsoft Office Forums