Results 1 to 5 of 5
  1. #1
    brharrii's Avatar
    brharrii is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jun 2012
    Location
    Seattle, WA
    Posts
    63

    Unbound text box truncates leading zeros

    I'm using an unbound text box to combine the values of two fields in order to create an ID to be used in controlling forms. One of the fields (DocumentID) is an auto number that is formatted to always produce a 5 digit number (00000). When I set the control source to =[documenttypecode] & [documentID] however, the leading zeros from the documentID field are truncated.



    Is it possible to change this so that the full document ID is displayed? once combined the unbound text box should display an ID with 4-6 leading alpha characters followed by 5 numerics.

    Thanks!

  2. #2
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742

    Use Format function

    Try the format function in your concatenation, something like this

    =[documenttypecode] & format([documentID],"00000")

  3. #3
    brharrii's Avatar
    brharrii is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jun 2012
    Location
    Seattle, WA
    Posts
    63
    Perfect, thank you

  4. #4
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    This looks like a solution to my own problems. Does anybody have any examples of code applying the format function as suggested?
    Slainte

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    There's an example in post 2. Search Access Help or the web for more info.
    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. Trying to get leading zeros to show
    By Pegasus_Angel in forum Access
    Replies: 3
    Last Post: 10-25-2012, 11:40 AM
  2. Leading Zeros
    By dirtbiker1824 in forum Access
    Replies: 1
    Last Post: 03-14-2011, 02:16 PM
  3. Adding Leading Zeros
    By jo15765 in forum Access
    Replies: 13
    Last Post: 11-20-2010, 11:11 PM
  4. Replies: 6
    Last Post: 04-30-2010, 01:57 PM
  5. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 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